<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>File Source for CssEventHandler.php</title>
	<link rel="stylesheet" type="text/css" href="../media/style.css">
	<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
	<script src="media/a.js"></script>
</head>
<body>

<table border="0" cellspacing="0" cellpadding="0" height="48" width="100%">
  <tr>
	<td class="header-top-left"><img src="../media/logo.png" border="0" alt="phpDocumentor " /></td>
    <td class="header-top-right">QueryPath<br /><div class="header-top-right-subpackage">CSSParser</div></td>
  </tr>
  <tr><td colspan="2" class="header-line"><img src="../media/empty.png" width="1" height="1" border="0" alt=""  /></td></tr>
  <tr>
    <td colspan="2" class="header-menu">
      
                        
                                                  		[ <a href="../classtrees_QueryPath.html" class="menu">class tree: QueryPath</a> ]
		[ <a href="../elementindex_QueryPath.html" class="menu">index: QueryPath</a> ]
            [ <a href="../elementindex.html" class="menu">all elements</a> ]
    </td>
  </tr>
  <tr><td colspan="2" class="header-line"><img src="../media/empty.png" width="1" height="1" border="0" alt=""  /></td></tr>
</table>

<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="195" class="menu">
		<div class="package-title">QueryPath</div>
  <div class="package">
	<div id="todolist">
			<p><a href="../todolist.html">Todo List</a></p>
	</div>
	</div>
      <b>Packages:</b><br />
  <div class="package">
              <a href="../li_QueryPath.html">QueryPath</a><br />
              <a href="../li_Examples.html">Examples</a><br />
              <a href="../li_Tests.html">Tests</a><br />
      	</div>
      <br />
                        <br />
                      </td>
    <td>
      <table cellpadding="10" cellspacing="0" width="100%" border="0"><tr><td valign="top">

<h1 align="center">Source for file CssEventHandler.php</h1>
<p>Documentation is available at <a href="../QueryPath/CSSParser/_src---QueryPath---CssEventHandler.php.html">CssEventHandler.php</a></p>
<div class="src-code"><span class="php">
<ol><li><div class="src-line"><a name="a1"></a><span class="src-php">&lt;?php</span></div></li>
<li><div class="src-line"><a name="a2"></a><span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a3"></a><span class="src-doc">&nbsp;*&nbsp;This&nbsp;file&nbsp;contains&nbsp;a&nbsp;full&nbsp;implementation&nbsp;of&nbsp;the&nbsp;CssEventHandler&nbsp;interface.</span></div></li>
<li><div class="src-line"><a name="a4"></a><span class="src-doc">&nbsp;*&nbsp;</span></div></li>
<li><div class="src-line"><a name="a5"></a><span class="src-doc">&nbsp;*&nbsp;The&nbsp;tools&nbsp;in&nbsp;this&nbsp;package&nbsp;initiate&nbsp;a&nbsp;CSS&nbsp;selector&nbsp;parsing&nbsp;routine&nbsp;and&nbsp;then</span></div></li>
<li><div class="src-line"><a name="a6"></a><span class="src-doc">&nbsp;*&nbsp;handle&nbsp;all&nbsp;of&nbsp;the&nbsp;callbacks.</span></div></li>
<li><div class="src-line"><a name="a7"></a><span class="src-doc">&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a8"></a><span class="src-doc">&nbsp;*&nbsp;The&nbsp;implementation&nbsp;provided&nbsp;herein&nbsp;adheres&nbsp;to&nbsp;the&nbsp;CSS&nbsp;3&nbsp;Selector&nbsp;specification</span></div></li>
<li><div class="src-line"><a name="a9"></a><span class="src-doc">&nbsp;*&nbsp;with&nbsp;the&nbsp;following&nbsp;caveats:</span></div></li>
<li><div class="src-line"><a name="a10"></a><span class="src-doc">&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a11"></a><span class="src-doc">&nbsp;*&nbsp;&nbsp;-&nbsp;The&nbsp;negation&nbsp;(:not())&nbsp;and&nbsp;containment&nbsp;(:has())&nbsp;pseudo-classes&nbsp;allow&nbsp;*full*</span></div></li>
<li><div class="src-line"><a name="a12"></a><span class="src-doc">&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;selectors&nbsp;and&nbsp;not&nbsp;just&nbsp;simple&nbsp;selectors.</span></div></li>
<li><div class="src-line"><a name="a13"></a><span class="src-doc">&nbsp;*&nbsp;&nbsp;-&nbsp;There&nbsp;are&nbsp;a&nbsp;variety&nbsp;of&nbsp;additional&nbsp;pseudo-classes&nbsp;supported&nbsp;by&nbsp;this</span></div></li>
<li><div class="src-line"><a name="a14"></a><span class="src-doc">&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;implementation&nbsp;that&nbsp;are&nbsp;not&nbsp;part&nbsp;of&nbsp;the&nbsp;spec.&nbsp;Most&nbsp;of&nbsp;the&nbsp;jQuery</span></div></li>
<li><div class="src-line"><a name="a15"></a><span class="src-doc">&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;pseudo-classes&nbsp;are&nbsp;supported.&nbsp;The&nbsp;:x-root&nbsp;pseudo-class&nbsp;is&nbsp;also&nbsp;supported.</span></div></li>
<li><div class="src-line"><a name="a16"></a><span class="src-doc">&nbsp;*&nbsp;&nbsp;-&nbsp;Pseudo-classes&nbsp;that&nbsp;require&nbsp;a&nbsp;User&nbsp;Agent&nbsp;to&nbsp;function&nbsp;have&nbsp;been&nbsp;disabled.</span></div></li>
<li><div class="src-line"><a name="a17"></a><span class="src-doc">&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;Thus&nbsp;there&nbsp;is&nbsp;no&nbsp;:hover&nbsp;pseudo-class.</span></div></li>
<li><div class="src-line"><a name="a18"></a><span class="src-doc">&nbsp;*&nbsp;&nbsp;-&nbsp;All&nbsp;pseudo-elements&nbsp;require&nbsp;the&nbsp;double-colon&nbsp;(::)&nbsp;notation.&nbsp;This&nbsp;breaks</span></div></li>
<li><div class="src-line"><a name="a19"></a><span class="src-doc">&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;backward&nbsp;compatibility&nbsp;with&nbsp;the&nbsp;2.1&nbsp;spec,&nbsp;but&nbsp;it&nbsp;makes&nbsp;visible&nbsp;the&nbsp;issue</span></div></li>
<li><div class="src-line"><a name="a20"></a><span class="src-doc">&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;that&nbsp;pseudo-elements&nbsp;cannot&nbsp;be&nbsp;effectively&nbsp;used&nbsp;with&nbsp;most&nbsp;of&nbsp;the&nbsp;present</span></div></li>
<li><div class="src-line"><a name="a21"></a><span class="src-doc">&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;library.&nbsp;They&nbsp;return&nbsp;strings&nbsp;instead&nbsp;of&nbsp;elements.</span></div></li>
<li><div class="src-line"><a name="a22"></a><span class="src-doc">&nbsp;*&nbsp;&nbsp;-&nbsp;The&nbsp;pseudo-classes&nbsp;first-of-type,&nbsp;nth-of-type&nbsp;and&nbsp;last-of-type&nbsp;may&nbsp;or&nbsp;may</span></div></li>
<li><div class="src-line"><a name="a23"></a><span class="src-doc">&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;not&nbsp;conform&nbsp;to&nbsp;the&nbsp;specification.&nbsp;The&nbsp;spec&nbsp;is&nbsp;unclear.</span></div></li>
<li><div class="src-line"><a name="a24"></a><span class="src-doc">&nbsp;*&nbsp;&nbsp;-&nbsp;pseudo-class&nbsp;filters&nbsp;of&nbsp;the&nbsp;form&nbsp;-an+b&nbsp;do&nbsp;not&nbsp;function&nbsp;as&nbsp;described&nbsp;in&nbsp;the</span></div></li>
<li><div class="src-line"><a name="a25"></a><span class="src-doc">&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;specification.&nbsp;However,&nbsp;they&nbsp;do&nbsp;behave&nbsp;the&nbsp;same&nbsp;way&nbsp;here&nbsp;as&nbsp;they&nbsp;do&nbsp;in</span></div></li>
<li><div class="src-line"><a name="a26"></a><span class="src-doc">&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;jQuery.</span></div></li>
<li><div class="src-line"><a name="a27"></a><span class="src-doc">&nbsp;*&nbsp;&nbsp;-&nbsp;This&nbsp;library&nbsp;DOES&nbsp;provide&nbsp;XML&nbsp;namespace&nbsp;aware&nbsp;tools.&nbsp;Selectors&nbsp;can&nbsp;use</span></div></li>
<li><div class="src-line"><a name="a28"></a><span class="src-doc">&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;namespaces&nbsp;to&nbsp;increase&nbsp;specificity.</span></div></li>
<li><div class="src-line"><a name="a29"></a><span class="src-doc">&nbsp;*&nbsp;&nbsp;-&nbsp;This&nbsp;library&nbsp;does&nbsp;nothing&nbsp;with&nbsp;the&nbsp;CSS&nbsp;3&nbsp;Selector&nbsp;specificity&nbsp;rating.&nbsp;Of</span></div></li>
<li><div class="src-line"><a name="a30"></a><span class="src-doc">&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;course&nbsp;specificity&nbsp;is&nbsp;preserved&nbsp;(to&nbsp;the&nbsp;best&nbsp;of&nbsp;our&nbsp;abilities),&nbsp;but&nbsp;there</span></div></li>
<li><div class="src-line"><a name="a31"></a><span class="src-doc">&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;is&nbsp;no&nbsp;calculation&nbsp;done.</span></div></li>
<li><div class="src-line"><a name="a32"></a><span class="src-doc">&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a33"></a><span class="src-doc">&nbsp;*&nbsp;For&nbsp;detailed&nbsp;examples&nbsp;of&nbsp;how&nbsp;the&nbsp;code&nbsp;works&nbsp;and&nbsp;what&nbsp;selectors&nbsp;are&nbsp;supported,</span></div></li>
<li><div class="src-line"><a name="a34"></a><span class="src-doc">&nbsp;*&nbsp;see&nbsp;the&nbsp;{@see&nbsp;CssEventTests.php}&nbsp;file,&nbsp;which&nbsp;contains&nbsp;the&nbsp;unit&nbsp;tests&nbsp;used&nbsp;for</span></div></li>
<li><div class="src-line"><a name="a35"></a><span class="src-doc">&nbsp;*&nbsp;testing&nbsp;this&nbsp;implementation.</span></div></li>
<li><div class="src-line"><a name="a36"></a><span class="src-doc">&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a37"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@package</span><span class="src-doc">&nbsp;QueryPath</span></div></li>
<li><div class="src-line"><a name="a38"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@subpackage</span><span class="src-doc">&nbsp;CSSParser</span></div></li>
<li><div class="src-line"><a name="a39"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@author</span><span class="src-doc">&nbsp;M&nbsp;Butcher&nbsp;&lt;matt@aleph-null.tv&gt;</span></div></li>
<li><div class="src-line"><a name="a40"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@license</span><span class="src-doc">&nbsp;http://opensource.org/licenses/lgpl-2.1.php&nbsp;LGPL&nbsp;(The&nbsp;GNU&nbsp;Lesser&nbsp;GPL)&nbsp;or&nbsp;an&nbsp;MIT-like&nbsp;license.</span></div></li>
<li><div class="src-line"><a name="a41"></a><span class="src-doc">&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a42"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a43"></a><span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a44"></a><span class="src-doc">&nbsp;*&nbsp;Require&nbsp;the&nbsp;parser&nbsp;library.</span></div></li>
<li><div class="src-line"><a name="a45"></a><span class="src-doc">&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a46"></a><span class="src-inc">require_once&nbsp;</span><span class="src-str">'CssParser.php'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a47"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a48"></a><span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a49"></a><span class="src-doc">&nbsp;*&nbsp;Handler&nbsp;that&nbsp;tracks&nbsp;progress&nbsp;of&nbsp;a&nbsp;query&nbsp;through&nbsp;a&nbsp;DOM.</span></div></li>
<li><div class="src-line"><a name="a50"></a><span class="src-doc">&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a51"></a><span class="src-doc">&nbsp;*&nbsp;The&nbsp;main&nbsp;idea&nbsp;is&nbsp;that&nbsp;we&nbsp;keep&nbsp;a&nbsp;copy&nbsp;of&nbsp;the&nbsp;tree,&nbsp;and&nbsp;then&nbsp;use&nbsp;an</span></div></li>
<li><div class="src-line"><a name="a52"></a><span class="src-doc">&nbsp;*&nbsp;array&nbsp;to&nbsp;keep&nbsp;track&nbsp;of&nbsp;matches.&nbsp;To&nbsp;handle&nbsp;a&nbsp;list&nbsp;of&nbsp;selectors&nbsp;(using</span></div></li>
<li><div class="src-line"><a name="a53"></a><span class="src-doc">&nbsp;*&nbsp;the&nbsp;comma&nbsp;separator),&nbsp;we&nbsp;have&nbsp;to&nbsp;track&nbsp;both&nbsp;the&nbsp;currently&nbsp;progressing</span></div></li>
<li><div class="src-line"><a name="a54"></a><span class="src-doc">&nbsp;*&nbsp;match&nbsp;and&nbsp;the&nbsp;previously&nbsp;matched&nbsp;elements.</span></div></li>
<li><div class="src-line"><a name="a55"></a><span class="src-doc">&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a56"></a><span class="src-doc">&nbsp;*&nbsp;To&nbsp;use&nbsp;this&nbsp;handler:</span></div></li>
<li><div class="src-line"><a name="a57"></a><span class="src-doc">&nbsp;*&nbsp;&lt;code&gt;</span></div></li>
<li><div class="src-line"><a name="a58"></a><span class="src-doc">&nbsp;*&nbsp;$filter&nbsp;=&nbsp;'#id';&nbsp;//&nbsp;Some&nbsp;CSS&nbsp;selector</span></div></li>
<li><div class="src-line"><a name="a59"></a><span class="src-doc">&nbsp;*&nbsp;$handler&nbsp;=&nbsp;new&nbsp;QueryPathCssParser(DOMNode&nbsp;$dom);</span></div></li>
<li><div class="src-line"><a name="a60"></a><span class="src-doc">&nbsp;*&nbsp;$parser&nbsp;=&nbsp;new&nbsp;CssParser();</span></div></li>
<li><div class="src-line"><a name="a61"></a><span class="src-doc">&nbsp;*&nbsp;$parser-&gt;parse($filter,&nbsp;$handler);</span></div></li>
<li><div class="src-line"><a name="a62"></a><span class="src-doc">&nbsp;*&nbsp;$matches&nbsp;=&nbsp;$handler-&gt;getMatches();</span></div></li>
<li><div class="src-line"><a name="a63"></a><span class="src-doc">&nbsp;*&nbsp;&lt;/code&gt;</span></div></li>
<li><div class="src-line"><a name="a64"></a><span class="src-doc">&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a65"></a><span class="src-doc">&nbsp;*&nbsp;$matches&nbsp;will&nbsp;be&nbsp;an&nbsp;array&nbsp;of&nbsp;zero&nbsp;or&nbsp;more&nbsp;DOMElement&nbsp;objects.</span></div></li>
<li><div class="src-line"><a name="a66"></a><span class="src-doc">&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a67"></a><span class="src-key">class&nbsp;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html">QueryPathCssEventHandler</a>&nbsp;<span class="src-key">implements&nbsp;</span><span class="src-id">CssEventHandler&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a68"></a>&nbsp;&nbsp;<span class="src-key">protected&nbsp;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$dom">$dom</a>&nbsp;=&nbsp;<span class="src-id">NULL</span><span class="src-sym">;&nbsp;</span><span class="src-comm">//&nbsp;Always&nbsp;points&nbsp;to&nbsp;the&nbsp;top&nbsp;level.</span></div></li>
<li><div class="src-line"><a name="a69"></a>&nbsp;&nbsp;<span class="src-key">protected&nbsp;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">$matches</a>&nbsp;=&nbsp;<span class="src-id">NULL</span><span class="src-sym">;&nbsp;</span><span class="src-comm">//&nbsp;The&nbsp;matches</span></div></li>
<li><div class="src-line"><a name="a70"></a>&nbsp;&nbsp;<span class="src-key">protected&nbsp;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$alreadyMatched">$alreadyMatched</a>&nbsp;=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;&nbsp;</span><span class="src-comm">//&nbsp;Matches&nbsp;found&nbsp;before&nbsp;current&nbsp;selector.</span></div></li>
<li><div class="src-line"><a name="a71"></a>&nbsp;&nbsp;<span class="src-key">protected&nbsp;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$findAnyElement">$findAnyElement</a>&nbsp;=&nbsp;<span class="src-id">TRUE</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a72"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a73"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a74"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a75"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;Create&nbsp;a&nbsp;new&nbsp;event&nbsp;handler.</span></div></li>
<li><div class="src-line"><a name="a76"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a77"></a>&nbsp;&nbsp;<span class="src-key">public&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#method__construct">__construct</a><span class="src-sym">(</span><span class="src-var">$dom</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a78"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Array&nbsp;of&nbsp;DOMElements</span></div></li>
<li><div class="src-line"><a name="a79"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$dom</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a80"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$matches&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a81"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach</span><span class="src-sym">(</span><span class="src-var">$dom&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$item</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a82"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$item&nbsp;</span>instanceof&nbsp;<span class="src-id">DOMNode&nbsp;</span>&amp;&amp;&nbsp;<span class="src-var">$item</span><span class="src-sym">-&gt;</span><span class="src-id">nodeType&nbsp;</span>==&nbsp;<span class="src-id">XML_ELEMENT_NODE</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a83"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$matches</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$item</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a84"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a85"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a86"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$dom">dom</a>&nbsp;=&nbsp;<a href="http://www.php.net/count">count</a><span class="src-sym">(</span><span class="src-var">$matches</span><span class="src-sym">)&nbsp;</span>&gt;&nbsp;<span class="src-num">0&nbsp;</span>?&nbsp;<span class="src-var">$matches</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]&nbsp;</span>:&nbsp;<span class="src-id">NULL</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a87"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-var">$matches</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a88"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a89"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;DOM&nbsp;Document&nbsp;--&nbsp;we&nbsp;get&nbsp;the&nbsp;root&nbsp;element.</span></div></li>
<li><div class="src-line"><a name="a90"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">elseif&nbsp;</span><span class="src-sym">(</span><span class="src-var">$dom&nbsp;</span>instanceof&nbsp;<span class="src-id">DOMDocument</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a91"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$dom">dom</a>&nbsp;=&nbsp;<span class="src-var">$dom</span><span class="src-sym">-&gt;</span><span class="src-id">documentElement</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a92"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-var">$dom</span><span class="src-sym">-&gt;</span><span class="src-id">documentElement</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a93"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a94"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;DOM&nbsp;Element&nbsp;--&nbsp;we&nbsp;use&nbsp;this&nbsp;directly</span></div></li>
<li><div class="src-line"><a name="a95"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">elseif&nbsp;</span><span class="src-sym">(</span><span class="src-var">$dom&nbsp;</span>instanceof&nbsp;<span class="src-id">DOMElement</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a96"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$dom">dom</a>&nbsp;=&nbsp;<span class="src-var">$dom</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a97"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-var">$dom</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a98"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a99"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;NodeList&nbsp;--&nbsp;We&nbsp;turn&nbsp;this&nbsp;into&nbsp;an&nbsp;array</span></div></li>
<li><div class="src-line"><a name="a100"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">elseif&nbsp;</span><span class="src-sym">(</span><span class="src-var">$dom&nbsp;</span>instanceof&nbsp;<span class="src-id">DOMNodeList</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a101"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$matches&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a102"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$dom&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$item</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a103"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$item</span><span class="src-sym">-&gt;</span><span class="src-id">nodeType&nbsp;</span>==&nbsp;<span class="src-id">XML_ELEMENT_NODE</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a104"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$matches</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$item</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a105"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a106"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a107"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$dom">dom</a>&nbsp;=&nbsp;<span class="src-var">$matches</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a108"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-var">$matches</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a109"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a110"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;FIXME:&nbsp;Handle&nbsp;SimpleXML!</span></div></li>
<li><div class="src-line"><a name="a111"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Uh-oh...&nbsp;we&nbsp;don't&nbsp;support&nbsp;anything&nbsp;else.</span></div></li>
<li><div class="src-line"><a name="a112"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">else&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a113"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id">Exception</span><span class="src-sym">(</span><span class="src-str">&quot;Unhandled&nbsp;type:&nbsp;&quot;&nbsp;</span>.&nbsp;<a href="http://www.php.net/get_class">get_class</a><span class="src-sym">(</span><span class="src-var">$dom</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a114"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a115"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a116"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a117"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a118"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;Generic&nbsp;finding&nbsp;method.</span></div></li>
<li><div class="src-line"><a name="a119"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a120"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;This&nbsp;is&nbsp;the&nbsp;primary&nbsp;searching&nbsp;method&nbsp;used&nbsp;throughout&nbsp;QueryPath.</span></div></li>
<li><div class="src-line"><a name="a121"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a122"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc-type">string&nbsp;</span><span class="src-doc-var">$filter&nbsp;</span></div></li>
<li><div class="src-line"><a name="a123"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;A&nbsp;valid&nbsp;CSS&nbsp;3&nbsp;filter.</span></div></li>
<li><div class="src-line"><a name="a124"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@return&nbsp;</span><span class="src-doc-type">QueryPathCssEventHandler&nbsp;</span></div></li>
<li><div class="src-line"><a name="a125"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;Returns&nbsp;itself.</span></div></li>
<li><div class="src-line"><a name="a126"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a127"></a>&nbsp;&nbsp;<span class="src-key">public&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodfind">find</a><span class="src-sym">(</span><span class="src-var">$filter</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a128"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$parser&nbsp;</span>=&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id"><a href="../QueryPath/CSSParser/CssParser.html">CssParser</a></span><span class="src-sym">(</span><span class="src-var">$filter</span><span class="src-sym">,&nbsp;</span><span class="src-var">$this</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a129"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$parser</span><span class="src-sym">-&gt;</span><span class="src-id">parse</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a130"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$this</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a131"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a132"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a133"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a134"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;Get&nbsp;the&nbsp;elements&nbsp;that&nbsp;match&nbsp;the&nbsp;evaluated&nbsp;selector.</span></div></li>
<li><div class="src-line"><a name="a135"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a136"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;This&nbsp;should&nbsp;be&nbsp;called&nbsp;after&nbsp;the&nbsp;filter&nbsp;has&nbsp;been&nbsp;parsed.</span></div></li>
<li><div class="src-line"><a name="a137"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a138"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@return&nbsp;</span><span class="src-doc-type">array&nbsp;</span></div></li>
<li><div class="src-line"><a name="a139"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;The&nbsp;matched&nbsp;items.&nbsp;This&nbsp;is&nbsp;almost&nbsp;always&nbsp;an&nbsp;array&nbsp;of</span></div></li>
<li><div class="src-line"><a name="a140"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;</span><span class="src-doc-inlinetag">{@link&nbsp;DOMElement}</span><span class="src-doc">&nbsp;objects.&nbsp;It&nbsp;is&nbsp;always&nbsp;an&nbsp;instance&nbsp;of</span></div></li>
<li><div class="src-line"><a name="a141"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;</span><span class="src-doc-inlinetag">{@link&nbsp;DOMNode}</span><span class="src-doc">&nbsp;objects.</span></div></li>
<li><div class="src-line"><a name="a142"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a143"></a>&nbsp;&nbsp;<span class="src-key">public&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodgetMatches">getMatches</a><span class="src-sym">(</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a144"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$result&nbsp;</span>=&nbsp;<a href="http://www.php.net/array_merge">array_merge</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$alreadyMatched">alreadyMatched</a><span class="src-sym">,&nbsp;</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a145"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$result</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a146"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a147"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a148"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a149"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;Find&nbsp;any&nbsp;element&nbsp;with&nbsp;the&nbsp;ID&nbsp;that&nbsp;matches&nbsp;$id.</span></div></li>
<li><div class="src-line"><a name="a150"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a151"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;If&nbsp;this&nbsp;finds&nbsp;an&nbsp;ID,&nbsp;it&nbsp;will&nbsp;immediately&nbsp;quit.&nbsp;Essentially,&nbsp;it&nbsp;doesn't</span></div></li>
<li><div class="src-line"><a name="a152"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;enforce&nbsp;ID&nbsp;uniqueness,&nbsp;but&nbsp;it&nbsp;assumes&nbsp;it.</span></div></li>
<li><div class="src-line"><a name="a153"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a154"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc-type">$id&nbsp;</span></div></li>
<li><div class="src-line"><a name="a155"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;</span><span class="src-doc">String&nbsp;ID&nbsp;for&nbsp;an&nbsp;element.</span></div></li>
<li><div class="src-line"><a name="a156"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a157"></a>&nbsp;&nbsp;<span class="src-key">public&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodelementID">elementID</a><span class="src-sym">(</span><span class="src-var">$id</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a158"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a159"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$matches&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-id">candidateList</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a160"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$matches&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$item</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a161"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Check&nbsp;if&nbsp;any&nbsp;of&nbsp;the&nbsp;current&nbsp;items&nbsp;has&nbsp;the&nbsp;desired&nbsp;ID.</span></div></li>
<li><div class="src-line"><a name="a162"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$item</span><span class="src-sym">-&gt;</span><span class="src-id">hasAttribute</span><span class="src-sym">(</span><span class="src-str">'id'</span><span class="src-sym">)&nbsp;</span>&amp;&amp;&nbsp;<span class="src-var">$item</span><span class="src-sym">-&gt;</span><span class="src-id">getAttribute</span><span class="src-sym">(</span><span class="src-str">'id'</span><span class="src-sym">)&nbsp;</span>===&nbsp;<span class="src-var">$id</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a163"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-var">$item</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a164"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a165"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a166"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a167"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-var">$found</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a168"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$findAnyElement">findAnyElement</a>&nbsp;=&nbsp;<span class="src-id">FALSE</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a169"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a170"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a171"></a>&nbsp;&nbsp;<span class="src-comm">//&nbsp;Inherited</span></div></li>
<li><div class="src-line"><a name="a172"></a>&nbsp;&nbsp;<span class="src-key">public&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodelement">element</a><span class="src-sym">(</span><span class="src-var">$name</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a173"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$matches&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-id">candidateList</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a174"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$findAnyElement">findAnyElement</a>&nbsp;=&nbsp;<span class="src-id">FALSE</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a175"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a176"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$matches&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$item</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a177"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Should&nbsp;the&nbsp;existing&nbsp;item&nbsp;be&nbsp;included?</span></div></li>
<li><div class="src-line"><a name="a178"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;In&nbsp;some&nbsp;cases&nbsp;(e.g.&nbsp;element&nbsp;is&nbsp;root&nbsp;element)</span></div></li>
<li><div class="src-line"><a name="a179"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;it&nbsp;definitely&nbsp;should.&nbsp;But&nbsp;what&nbsp;about&nbsp;other&nbsp;cases?</span></div></li>
<li><div class="src-line"><a name="a180"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$item</span><span class="src-sym">-&gt;</span><span class="src-id">tagName&nbsp;</span>==&nbsp;<span class="src-var">$name</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a181"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$item</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a182"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a183"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Search&nbsp;for&nbsp;matching&nbsp;kids.</span></div></li>
<li><div class="src-line"><a name="a184"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//$nl&nbsp;=&nbsp;$item-&gt;getElementsByTagName($name);</span></div></li>
<li><div class="src-line"><a name="a185"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//$found&nbsp;=&nbsp;array_merge($found,&nbsp;$this-&gt;nodeListToArray($nl));</span></div></li>
<li><div class="src-line"><a name="a186"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a187"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a188"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-id"><a href="../QueryPath/CSSParser/UniqueElementList.html">UniqueElementList</a></span><span class="src-sym">::</span><a href="../QueryPath/CSSParser/UniqueElementList.html#methodget">get</a><span class="src-sym">(</span><span class="src-var">$found</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a189"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a190"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a191"></a>&nbsp;&nbsp;<span class="src-comm">//&nbsp;Inherited</span></div></li>
<li><div class="src-line"><a name="a192"></a>&nbsp;&nbsp;<span class="src-key">public&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodelementNS">elementNS</a><span class="src-sym">(</span><span class="src-var">$lname</span><span class="src-sym">,&nbsp;</span><span class="src-var">$namespace&nbsp;</span>=&nbsp;<span class="src-id">NULL</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a193"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$findAnyElement">findAnyElement</a>&nbsp;=&nbsp;<span class="src-id">FALSE</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a194"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a195"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$matches&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-id">candidateList</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a196"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$matches&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$item</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a197"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Looking&nbsp;up&nbsp;NS&nbsp;URI&nbsp;only&nbsp;works&nbsp;if&nbsp;the&nbsp;XMLNS&nbsp;attributes&nbsp;are&nbsp;declared</span></div></li>
<li><div class="src-line"><a name="a198"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;at&nbsp;a&nbsp;level&nbsp;equal&nbsp;to&nbsp;or&nbsp;above&nbsp;the&nbsp;searching&nbsp;doc.&nbsp;Normalizing&nbsp;a&nbsp;doc</span></div></li>
<li><div class="src-line"><a name="a199"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;should&nbsp;fix&nbsp;this,&nbsp;but&nbsp;it&nbsp;doesn't.&nbsp;So&nbsp;we&nbsp;have&nbsp;to&nbsp;use&nbsp;a&nbsp;fallback&nbsp;</span></div></li>
<li><div class="src-line"><a name="a200"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;detection&nbsp;scheme&nbsp;which&nbsp;basically&nbsp;searches&nbsp;by&nbsp;lname&nbsp;and&nbsp;then&nbsp;</span></div></li>
<li><div class="src-line"><a name="a201"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;does&nbsp;a&nbsp;post&nbsp;hoc&nbsp;check&nbsp;on&nbsp;the&nbsp;tagname.</span></div></li>
<li><div class="src-line"><a name="a202"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a203"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//$nsuri&nbsp;=&nbsp;$item-&gt;lookupNamespaceURI($namespace);</span></div></li>
<li><div class="src-line"><a name="a204"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$nsuri&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$dom">dom</a><span class="src-sym">-&gt;</span><span class="src-id">lookupNamespaceURI</span><span class="src-sym">(</span><span class="src-var">$namespace</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a205"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$nsuri</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a206"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$nl&nbsp;</span>=&nbsp;<span class="src-var">$item</span><span class="src-sym">-&gt;</span><span class="src-id">getElementsByTagNameNS</span><span class="src-sym">(</span><span class="src-var">$nsuri</span><span class="src-sym">,&nbsp;</span><span class="src-var">$lname</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a207"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;If&nbsp;something&nbsp;is&nbsp;found,&nbsp;merge&nbsp;them:</span></div></li>
<li><div class="src-line"><a name="a208"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$nl</span><span class="src-sym">))&nbsp;</span><span class="src-var">$found&nbsp;</span>=&nbsp;<a href="http://www.php.net/array_merge">array_merge</a><span class="src-sym">(</span><span class="src-var">$found</span><span class="src-sym">,&nbsp;</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodnodeListToArray">nodeListToArray</a><span class="src-sym">(</span><span class="src-var">$nl</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a209"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a210"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">else&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a211"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//$nl&nbsp;=&nbsp;$item-&gt;getElementsByTagName($namespace&nbsp;.&nbsp;':'&nbsp;.&nbsp;$lname);</span></div></li>
<li><div class="src-line"><a name="a212"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$nl&nbsp;</span>=&nbsp;<span class="src-var">$item</span><span class="src-sym">-&gt;</span><span class="src-id">getElementsByTagName</span><span class="src-sym">(</span><span class="src-var">$lname</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a213"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$tagname&nbsp;</span>=&nbsp;<span class="src-var">$namespace&nbsp;</span>.&nbsp;<span class="src-str">':'&nbsp;</span>.&nbsp;<span class="src-var">$lname</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a214"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$nsmatches&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a215"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$nl&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$node</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a216"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$node</span><span class="src-sym">-&gt;</span><span class="src-id">tagName&nbsp;</span>==&nbsp;<span class="src-var">$tagname</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a217"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$nsmatches</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$node</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a218"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a219"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a220"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;If&nbsp;something&nbsp;is&nbsp;found,&nbsp;merge&nbsp;them:</span></div></li>
<li><div class="src-line"><a name="a221"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$nsmatches</span><span class="src-sym">))&nbsp;</span><span class="src-var">$found&nbsp;</span>=&nbsp;<a href="http://www.php.net/array_merge">array_merge</a><span class="src-sym">(</span><span class="src-var">$found</span><span class="src-sym">,&nbsp;</span><span class="src-var">$nsmatches</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a222"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a223"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a224"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-var">$found</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a225"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a226"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a227"></a>&nbsp;&nbsp;<span class="src-key">public&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodanyElement">anyElement</a><span class="src-sym">(</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a228"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a229"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$findAnyElement">findAnyElement</a>&nbsp;=&nbsp;<span class="src-id">TRUE</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a230"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$matches&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-id">candidateList</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a231"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$matches&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$item</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a232"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$item</span><span class="src-sym">;&nbsp;</span><span class="src-comm">//&nbsp;Add&nbsp;self</span></div></li>
<li><div class="src-line"><a name="a233"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$nl&nbsp;</span>=&nbsp;<span class="src-var">$item</span><span class="src-sym">-&gt;</span><span class="src-id">getElementsByTagName</span><span class="src-sym">(</span><span class="src-str">'*'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a234"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found&nbsp;</span>=&nbsp;<a href="http://www.php.net/array_merge">array_merge</a><span class="src-sym">(</span><span class="src-var">$found</span><span class="src-sym">,&nbsp;</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodnodeListToArray">nodeListToArray</a><span class="src-sym">(</span><span class="src-var">$nl</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a235"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a236"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a237"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-id"><a href="../QueryPath/CSSParser/UniqueElementList.html">UniqueElementList</a></span><span class="src-sym">::</span><a href="../QueryPath/CSSParser/UniqueElementList.html#methodget">get</a><span class="src-sym">(</span><span class="src-var">$found</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a238"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$findAnyElement">findAnyElement</a>&nbsp;=&nbsp;<span class="src-id">FALSE</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a239"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a240"></a>&nbsp;&nbsp;<span class="src-key">public&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodanyElementInNS">anyElementInNS</a><span class="src-sym">(</span><span class="src-var">$ns</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a241"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$findAnyElement">findAnyElement</a>&nbsp;=&nbsp;<span class="src-id">TRUE</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a242"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$nsuri&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$dom">dom</a><span class="src-sym">-&gt;</span><span class="src-id">lookupNamespaceURI</span><span class="src-sym">(</span><span class="src-var">$ns</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a243"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a244"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$nsuri</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a245"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$matches&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-id">candidateList</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a246"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$matches&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$item</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a247"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$nl&nbsp;</span>=&nbsp;<span class="src-var">$item</span><span class="src-sym">-&gt;</span><span class="src-id">getElementsByTagNameNS</span><span class="src-sym">(</span><span class="src-var">$nsuri</span><span class="src-sym">,&nbsp;</span><span class="src-str">'*'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a248"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$nl</span><span class="src-sym">))&nbsp;</span><span class="src-var">$found&nbsp;</span>=&nbsp;<a href="http://www.php.net/array_merge">array_merge</a><span class="src-sym">(</span><span class="src-var">$found</span><span class="src-sym">,&nbsp;</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodnodeListToArray">nodeListToArray</a><span class="src-sym">(</span><span class="src-var">$nl</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a249"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a250"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a251"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-id"><a href="../QueryPath/CSSParser/UniqueElementList.html">UniqueElementList</a></span><span class="src-sym">::</span><a href="../QueryPath/CSSParser/UniqueElementList.html#methodget">get</a><span class="src-sym">(</span><span class="src-var">$found</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a252"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$findAnyElement">findAnyElement</a>&nbsp;=&nbsp;<span class="src-id">FALSE</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a253"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a254"></a>&nbsp;&nbsp;<span class="src-key">public&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodelementClass">elementClass</a><span class="src-sym">(</span><span class="src-var">$name</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a255"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a256"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a257"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$matches&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-id">candidateList</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a258"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$matches&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$item</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a259"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$item</span><span class="src-sym">-&gt;</span><span class="src-id">hasAttribute</span><span class="src-sym">(</span><span class="src-str">'class'</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a260"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$classes&nbsp;</span>=&nbsp;<a href="http://www.php.net/explode">explode</a><span class="src-sym">(</span><span class="src-str">'&nbsp;'</span><span class="src-sym">,&nbsp;</span><span class="src-var">$item</span><span class="src-sym">-&gt;</span><span class="src-id">getAttribute</span><span class="src-sym">(</span><span class="src-str">'class'</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a261"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><a href="http://www.php.net/in_array">in_array</a><span class="src-sym">(</span><span class="src-var">$name</span><span class="src-sym">,&nbsp;</span><span class="src-var">$classes</span><span class="src-sym">))&nbsp;</span><span class="src-var">$found</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$item</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a262"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a263"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a264"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a265"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-id"><a href="../QueryPath/CSSParser/UniqueElementList.html">UniqueElementList</a></span><span class="src-sym">::</span><a href="../QueryPath/CSSParser/UniqueElementList.html#methodget">get</a><span class="src-sym">(</span><span class="src-var">$found</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a266"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$findAnyElement">findAnyElement</a>&nbsp;=&nbsp;<span class="src-id">FALSE</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a267"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a268"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a269"></a>&nbsp;&nbsp;<span class="src-key">public&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodattribute">attribute</a><span class="src-sym">(</span><span class="src-var">$name</span><span class="src-sym">,&nbsp;</span><span class="src-var">$value&nbsp;</span>=&nbsp;<span class="src-id">NULL</span><span class="src-sym">,&nbsp;</span><span class="src-var">$operation&nbsp;</span>=&nbsp;<span class="src-id">CssEventHandler</span><span class="src-sym">::</span><span class="src-id">isExactly</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a270"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a271"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$matches&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-id">candidateList</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a272"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$matches&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$item</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a273"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$item</span><span class="src-sym">-&gt;</span><span class="src-id">hasAttribute</span><span class="src-sym">(</span><span class="src-var">$name</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a274"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-var">$value</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a275"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;If&nbsp;a&nbsp;value&nbsp;exists,&nbsp;then&nbsp;we&nbsp;need&nbsp;a&nbsp;match.</span></div></li>
<li><div class="src-line"><a name="a276"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodattrValMatches">attrValMatches</a><span class="src-sym">(</span><span class="src-var">$value</span><span class="src-sym">,&nbsp;</span><span class="src-var">$item</span><span class="src-sym">-&gt;</span><span class="src-id">getAttribute</span><span class="src-sym">(</span><span class="src-var">$name</span><span class="src-sym">)</span><span class="src-sym">,&nbsp;</span><span class="src-var">$operation</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a277"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$item</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a278"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a279"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a280"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">else&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a281"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;If&nbsp;no&nbsp;value&nbsp;exists,&nbsp;then&nbsp;we&nbsp;consider&nbsp;it&nbsp;a&nbsp;match.</span></div></li>
<li><div class="src-line"><a name="a282"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$item</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a283"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a284"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a285"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a286"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-id"><a href="../QueryPath/CSSParser/UniqueElementList.html">UniqueElementList</a></span><span class="src-sym">::</span><a href="../QueryPath/CSSParser/UniqueElementList.html#methodget">get</a><span class="src-sym">(</span><span class="src-var">$found</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a287"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$findAnyElement">findAnyElement</a>&nbsp;=&nbsp;<span class="src-id">FALSE</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a288"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a289"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a290"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a291"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;Helper&nbsp;function&nbsp;to&nbsp;find&nbsp;all&nbsp;elements&nbsp;with&nbsp;exact&nbsp;matches.</span></div></li>
<li><div class="src-line"><a name="a292"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;</span></div></li>
<li><div class="src-line"><a name="a293"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@deprecated</span><span class="src-doc">&nbsp;All&nbsp;use&nbsp;cases&nbsp;seem&nbsp;to&nbsp;be&nbsp;covered&nbsp;by&nbsp;attribute().</span></div></li>
<li><div class="src-line"><a name="a294"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a295"></a>&nbsp;&nbsp;<span class="src-key">protected&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodsearchForAttr">searchForAttr</a><span class="src-sym">(</span><span class="src-var">$name</span><span class="src-sym">,&nbsp;</span><span class="src-var">$value&nbsp;</span>=&nbsp;<span class="src-id">NULL</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a296"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a297"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$matches&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-id">candidateList</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a298"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$matches&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$candidate</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a299"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$candidate</span><span class="src-sym">-&gt;</span><span class="src-id">hasAttribute</span><span class="src-sym">(</span><span class="src-var">$name</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a300"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;If&nbsp;value&nbsp;is&nbsp;required,&nbsp;match&nbsp;that,&nbsp;too.</span></div></li>
<li><div class="src-line"><a name="a301"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-var">$value</span><span class="src-sym">)&nbsp;</span>&amp;&amp;&nbsp;<span class="src-var">$value&nbsp;</span>==&nbsp;<span class="src-var">$candidate</span><span class="src-sym">-&gt;</span><span class="src-id">getAttribute</span><span class="src-sym">(</span><span class="src-var">$name</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a302"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$candidate</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a303"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a304"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Otherwise,&nbsp;it's&nbsp;a&nbsp;match&nbsp;on&nbsp;name&nbsp;alone.</span></div></li>
<li><div class="src-line"><a name="a305"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">else&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a306"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$candidate</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a307"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a308"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a309"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a310"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a311"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-var">$found</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a312"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a313"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a314"></a>&nbsp;&nbsp;<span class="src-key">public&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodattributeNS">attributeNS</a><span class="src-sym">(</span><span class="src-var">$lname</span><span class="src-sym">,&nbsp;</span><span class="src-var">$ns</span><span class="src-sym">,&nbsp;</span><span class="src-var">$value&nbsp;</span>=&nbsp;<span class="src-id">NULL</span><span class="src-sym">,&nbsp;</span><span class="src-var">$operation&nbsp;</span>=&nbsp;<span class="src-id">CssEventHandler</span><span class="src-sym">::</span><span class="src-id">isExactly</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a315"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$matches&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-id">candidateList</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a316"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a317"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><a href="http://www.php.net/count">count</a><span class="src-sym">(</span><span class="src-var">$matches</span><span class="src-sym">)&nbsp;</span>==&nbsp;<span class="src-num">0</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a318"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a319"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a320"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a321"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a322"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Get&nbsp;the&nbsp;namespace&nbsp;URI&nbsp;for&nbsp;the&nbsp;given&nbsp;label.</span></div></li>
<li><div class="src-line"><a name="a323"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$uri&nbsp;</span>=&nbsp;<span class="src-var">$matches</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">-&gt;</span><span class="src-id">lookupNamespaceURI</span><span class="src-sym">(</span><span class="src-var">$ns</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a324"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a325"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$matches&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$item</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a326"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//foreach&nbsp;($item-&gt;attributes&nbsp;as&nbsp;$attr)&nbsp;{</span></div></li>
<li><div class="src-line"><a name="a327"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;&nbsp;print&nbsp;&quot;$attr-&gt;prefix:$attr-&gt;localName&nbsp;($attr-&gt;namespaceURI),&nbsp;Value:&nbsp;$attr-&gt;nodeValue\n&quot;;</span></div></li>
<li><div class="src-line"><a name="a328"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//}</span></div></li>
<li><div class="src-line"><a name="a329"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$item</span><span class="src-sym">-&gt;</span><span class="src-id">hasAttributeNS</span><span class="src-sym">(</span><span class="src-var">$uri</span><span class="src-sym">,&nbsp;</span><span class="src-var">$lname</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a330"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-var">$value</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a331"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodattrValMatches">attrValMatches</a><span class="src-sym">(</span><span class="src-var">$value</span><span class="src-sym">,&nbsp;</span><span class="src-var">$item</span><span class="src-sym">-&gt;</span><span class="src-id">getAttributeNS</span><span class="src-sym">(</span><span class="src-var">$uri</span><span class="src-sym">,&nbsp;</span><span class="src-var">$lname</span><span class="src-sym">)</span><span class="src-sym">,&nbsp;</span><span class="src-var">$operation</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a332"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$item</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a333"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a334"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a335"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">else&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a336"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$item</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a337"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a338"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a339"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a340"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-id"><a href="../QueryPath/CSSParser/UniqueElementList.html">UniqueElementList</a></span><span class="src-sym">::</span><a href="../QueryPath/CSSParser/UniqueElementList.html#methodget">get</a><span class="src-sym">(</span><span class="src-var">$found</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a341"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$findAnyElement">findAnyElement</a>&nbsp;=&nbsp;<span class="src-id">FALSE</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a342"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a343"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a344"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a345"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;This&nbsp;also&nbsp;supports&nbsp;the&nbsp;following&nbsp;nonstandard&nbsp;pseudo&nbsp;classes:</span></div></li>
<li><div class="src-line"><a name="a346"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;-&nbsp;:x-reset/:x-root&nbsp;(reset&nbsp;to&nbsp;the&nbsp;main&nbsp;item&nbsp;passed&nbsp;into&nbsp;the&nbsp;constructor.&nbsp;Less&nbsp;drastic&nbsp;than&nbsp;:root)</span></div></li>
<li><div class="src-line"><a name="a347"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;-&nbsp;:odd/:even&nbsp;(shorthand&nbsp;for&nbsp;:nth-child(odd)/:nth-child(even))</span></div></li>
<li><div class="src-line"><a name="a348"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a349"></a>&nbsp;&nbsp;<span class="src-key">public&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodpseudoClass">pseudoClass</a><span class="src-sym">(</span><span class="src-var">$name</span><span class="src-sym">,&nbsp;</span><span class="src-var">$value&nbsp;</span>=&nbsp;<span class="src-id">NULL</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a350"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$name&nbsp;</span>=&nbsp;<a href="http://www.php.net/strtolower">strtolower</a><span class="src-sym">(</span><span class="src-var">$name</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a351"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Need&nbsp;to&nbsp;handle&nbsp;known&nbsp;pseudoclasses.</span></div></li>
<li><div class="src-line"><a name="a352"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">switch</span><span class="src-sym">(</span><span class="src-var">$name</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a353"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'visited'</span>:</div></li>
<li><div class="src-line"><a name="a354"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'hover'</span>:</div></li>
<li><div class="src-line"><a name="a355"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'active'</span>:</div></li>
<li><div class="src-line"><a name="a356"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'focus'</span>:</div></li>
<li><div class="src-line"><a name="a357"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'animated'</span>:&nbsp;<span class="src-comm">//&nbsp;&nbsp;Last&nbsp;3&nbsp;are&nbsp;from&nbsp;jQuery</span></div></li>
<li><div class="src-line"><a name="a358"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'visible'</span>:</div></li>
<li><div class="src-line"><a name="a359"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'hidden'</span>:</div></li>
<li><div class="src-line"><a name="a360"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;These&nbsp;require&nbsp;a&nbsp;UA,&nbsp;which&nbsp;we&nbsp;don't&nbsp;have.</span></div></li>
<li><div class="src-line"><a name="a361"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'target'</span>:</div></li>
<li><div class="src-line"><a name="a362"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;This&nbsp;requires&nbsp;a&nbsp;location&nbsp;URL,&nbsp;which&nbsp;we&nbsp;don't&nbsp;have.</span></div></li>
<li><div class="src-line"><a name="a363"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a364"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a365"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'indeterminate'</span>:</div></li>
<li><div class="src-line"><a name="a366"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;The&nbsp;assumption&nbsp;is&nbsp;that&nbsp;there&nbsp;is&nbsp;a&nbsp;UA&nbsp;and&nbsp;the&nbsp;format&nbsp;is&nbsp;HTML.</span></div></li>
<li><div class="src-line"><a name="a367"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;I&nbsp;don't&nbsp;know&nbsp;if&nbsp;this&nbsp;should&nbsp;is&nbsp;useful&nbsp;without&nbsp;a&nbsp;UA.</span></div></li>
<li><div class="src-line"><a name="a368"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id"><a href="../QueryPath/CSSParser/NotImplementedException.html">NotImplementedException</a></span><span class="src-sym">(</span><span class="src-str">&quot;:indeterminate&nbsp;is&nbsp;not&nbsp;implemented.&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a369"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a370"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'lang'</span>:</div></li>
<li><div class="src-line"><a name="a371"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;No&nbsp;value&nbsp;=&nbsp;exception.</span></div></li>
<li><div class="src-line"><a name="a372"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span>isset<span class="src-sym">(</span><span class="src-var">$value</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a373"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id"><a href="../QueryPath/CSSParser/NotImplementedException.html">NotImplementedException</a></span><span class="src-sym">(</span><span class="src-str">&quot;No&nbsp;handler&nbsp;for&nbsp;lang&nbsp;pseudoclass&nbsp;without&nbsp;value.&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a374"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a375"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodlang">lang</a><span class="src-sym">(</span><span class="src-var">$value</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a376"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a377"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'link'</span>:</div></li>
<li><div class="src-line"><a name="a378"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodsearchForAttr">searchForAttr</a><span class="src-sym">(</span><span class="src-str">'href'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a379"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a380"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'root'</span>:</div></li>
<li><div class="src-line"><a name="a381"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$dom">dom</a><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a382"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a383"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a384"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">elseif&nbsp;</span><span class="src-sym">(</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$dom">dom</a><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a385"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$dom">dom</a><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">-&gt;</span><span class="src-id">ownerDocument</span><span class="src-sym">-&gt;</span><span class="src-id">documentElement</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a386"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a387"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">elseif&nbsp;</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$dom">dom</a>&nbsp;instanceof&nbsp;<span class="src-id">DOMNode</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a388"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$dom">dom</a><span class="src-sym">-&gt;</span><span class="src-id">ownerDocument</span><span class="src-sym">-&gt;</span><span class="src-id">documentElement</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a389"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a390"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">elseif&nbsp;</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$dom">dom</a>&nbsp;instanceof&nbsp;<span class="src-id">DOMNodeList&nbsp;</span>&amp;&amp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$dom">dom</a><span class="src-sym">-&gt;</span><span class="src-id">length&nbsp;</span>&gt;&nbsp;<span class="src-num">0</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a391"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$dom">dom</a><span class="src-sym">-&gt;</span><span class="src-id">item</span><span class="src-sym">(</span><span class="src-num">0</span><span class="src-sym">)</span><span class="src-sym">-&gt;</span><span class="src-id">ownerDocument</span><span class="src-sym">-&gt;</span><span class="src-id">documentElement</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a392"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a393"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">else&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a394"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Hopefully&nbsp;we&nbsp;never&nbsp;get&nbsp;here:</span></div></li>
<li><div class="src-line"><a name="a395"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$dom">dom</a><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a396"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a397"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a398"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a399"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;NON-STANDARD&nbsp;extensions&nbsp;for&nbsp;reseting&nbsp;to&nbsp;the&nbsp;&quot;top&quot;&nbsp;items&nbsp;set&nbsp;in</span></div></li>
<li><div class="src-line"><a name="a400"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;the&nbsp;constructor.&nbsp;&nbsp;</span></div></li>
<li><div class="src-line"><a name="a401"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'x-root'</span>:</div></li>
<li><div class="src-line"><a name="a402"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'x-reset'</span>:</div></li>
<li><div class="src-line"><a name="a403"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$dom">dom</a><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a404"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></div></li>
<li><div class="src-line"><a name="a405"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a406"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;NON-STANDARD&nbsp;extensions&nbsp;for&nbsp;simple&nbsp;support&nbsp;of&nbsp;even&nbsp;and&nbsp;odd.&nbsp;These</span></div></li>
<li><div class="src-line"><a name="a407"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;are&nbsp;supported&nbsp;by&nbsp;jQuery,&nbsp;FF,&nbsp;and&nbsp;other&nbsp;user&nbsp;agents.&nbsp;&nbsp;</span></div></li>
<li><div class="src-line"><a name="a408"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'even'</span>:</div></li>
<li><div class="src-line"><a name="a409"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodnthChild">nthChild</a><span class="src-sym">(</span><span class="src-num">2</span><span class="src-sym">,&nbsp;</span><span class="src-num">0</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a410"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a411"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'odd'</span>:</div></li>
<li><div class="src-line"><a name="a412"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodnthChild">nthChild</a><span class="src-sym">(</span><span class="src-num">2</span><span class="src-sym">,&nbsp;</span><span class="src-num">1</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a413"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a414"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a415"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Standard&nbsp;child-checking&nbsp;items.&nbsp;&nbsp;</span></div></li>
<li><div class="src-line"><a name="a416"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'nth-child'</span>:</div></li>
<li><div class="src-line"><a name="a417"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;list<span class="src-sym">(</span><span class="src-var">$aVal</span><span class="src-sym">,&nbsp;</span><span class="src-var">$bVal</span><span class="src-sym">)&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodparseAnB">parseAnB</a><span class="src-sym">(</span><span class="src-var">$value</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a418"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodnthChild">nthChild</a><span class="src-sym">(</span><span class="src-var">$aVal</span><span class="src-sym">,&nbsp;</span><span class="src-var">$bVal</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a419"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a420"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'nth-last-child'</span>:</div></li>
<li><div class="src-line"><a name="a421"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;list<span class="src-sym">(</span><span class="src-var">$aVal</span><span class="src-sym">,&nbsp;</span><span class="src-var">$bVal</span><span class="src-sym">)&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodparseAnB">parseAnB</a><span class="src-sym">(</span><span class="src-var">$value</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a422"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodnthLastChild">nthLastChild</a><span class="src-sym">(</span><span class="src-var">$aVal</span><span class="src-sym">,&nbsp;</span><span class="src-var">$bVal</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a423"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a424"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'nth-of-type'</span>:</div></li>
<li><div class="src-line"><a name="a425"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;list<span class="src-sym">(</span><span class="src-var">$aVal</span><span class="src-sym">,&nbsp;</span><span class="src-var">$bVal</span><span class="src-sym">)&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodparseAnB">parseAnB</a><span class="src-sym">(</span><span class="src-var">$value</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a426"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodnthOfTypeChild">nthOfTypeChild</a><span class="src-sym">(</span><span class="src-var">$aVal</span><span class="src-sym">,&nbsp;</span><span class="src-var">$bVal</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a427"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a428"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'nth-last-of-type'</span>:</div></li>
<li><div class="src-line"><a name="a429"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;list<span class="src-sym">(</span><span class="src-var">$aVal</span><span class="src-sym">,&nbsp;</span><span class="src-var">$bVal</span><span class="src-sym">)&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodparseAnB">parseAnB</a><span class="src-sym">(</span><span class="src-var">$value</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a430"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodnthLastOfTypeChild">nthLastOfTypeChild</a><span class="src-sym">(</span><span class="src-var">$aVal</span><span class="src-sym">,&nbsp;</span><span class="src-var">$bVal</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a431"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a432"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'first-child'</span>:</div></li>
<li><div class="src-line"><a name="a433"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodnthChild">nthChild</a><span class="src-sym">(</span><span class="src-num">0</span><span class="src-sym">,&nbsp;</span><span class="src-num">1</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a434"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a435"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'last-child'</span>:</div></li>
<li><div class="src-line"><a name="a436"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodnthLastChild">nthLastChild</a><span class="src-sym">(</span><span class="src-num">0</span><span class="src-sym">,&nbsp;</span><span class="src-num">1</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a437"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a438"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'first-of-type'</span>:</div></li>
<li><div class="src-line"><a name="a439"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodfirstOfType">firstOfType</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a440"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a441"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'last-of-type'</span>:</div></li>
<li><div class="src-line"><a name="a442"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodlastOfType">lastOfType</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a443"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a444"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'only-child'</span>:</div></li>
<li><div class="src-line"><a name="a445"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodonlyChild">onlyChild</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a446"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a447"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'only-of-type'</span>:</div></li>
<li><div class="src-line"><a name="a448"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodonlyOfType">onlyOfType</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a449"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a450"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'empty'</span>:</div></li>
<li><div class="src-line"><a name="a451"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodemptyElement">emptyElement</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a452"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;&nbsp;&nbsp;</span></div></li>
<li><div class="src-line"><a name="a453"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'not'</span>:</div></li>
<li><div class="src-line"><a name="a454"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$value</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a455"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id">CssParseException</span><span class="src-sym">(</span><span class="src-str">&quot;:not()&nbsp;requires&nbsp;a&nbsp;value.&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a456"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a457"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodnot">not</a><span class="src-sym">(</span><span class="src-var">$value</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a458"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a459"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Additional&nbsp;pseudo-classes&nbsp;defined&nbsp;in&nbsp;jQuery:</span></div></li>
<li><div class="src-line"><a name="a460"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'lt'</span>:</div></li>
<li><div class="src-line"><a name="a461"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'gt'</span>:</div></li>
<li><div class="src-line"><a name="a462"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'nth'</span>:</div></li>
<li><div class="src-line"><a name="a463"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'eq'</span>:</div></li>
<li><div class="src-line"><a name="a464"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'first'</span>:</div></li>
<li><div class="src-line"><a name="a465"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'last'</span>:</div></li>
<li><div class="src-line"><a name="a466"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//case&nbsp;'even':</span></div></li>
<li><div class="src-line"><a name="a467"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//case&nbsp;'odd':</span></div></li>
<li><div class="src-line"><a name="a468"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-id">getByPosition</span><span class="src-sym">(</span><span class="src-var">$name</span><span class="src-sym">,&nbsp;</span><span class="src-var">$value</span><span class="src-sym">)</span><span class="src-sym">;&nbsp;&nbsp;</span></div></li>
<li><div class="src-line"><a name="a469"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a470"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'parent'</span>:</div></li>
<li><div class="src-line"><a name="a471"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$matches&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-id">candidateList</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a472"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a473"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$matches&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$match</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a474"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$match</span><span class="src-sym">-&gt;</span><span class="src-id">firstChild</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a475"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$match</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a476"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a477"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a478"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-id"><a href="../QueryPath/CSSParser/UniqueElementList.html">UniqueElementList</a></span><span class="src-sym">::</span><a href="../QueryPath/CSSParser/UniqueElementList.html#methodget">get</a><span class="src-sym">(</span><span class="src-var">$found</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a479"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a480"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a481"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'enabled'</span>:&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a482"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'disabled'</span>:&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a483"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'checked'</span>:&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a484"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodattribute">attribute</a><span class="src-sym">(</span><span class="src-var">$name</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a485"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a486"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'text'</span>:</div></li>
<li><div class="src-line"><a name="a487"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'radio'</span>:</div></li>
<li><div class="src-line"><a name="a488"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'checkbox'</span>:</div></li>
<li><div class="src-line"><a name="a489"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'file'</span>:</div></li>
<li><div class="src-line"><a name="a490"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'password'</span>:</div></li>
<li><div class="src-line"><a name="a491"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'submit'</span>:</div></li>
<li><div class="src-line"><a name="a492"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'image'</span>:</div></li>
<li><div class="src-line"><a name="a493"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'reset'</span>:</div></li>
<li><div class="src-line"><a name="a494"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'button'</span>:</div></li>
<li><div class="src-line"><a name="a495"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'submit'</span>:</div></li>
<li><div class="src-line"><a name="a496"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodattribute">attribute</a><span class="src-sym">(</span><span class="src-str">'type'</span><span class="src-sym">,&nbsp;</span><span class="src-var">$name</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a497"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a498"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a499"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'header'</span>:</div></li>
<li><div class="src-line"><a name="a500"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$matches&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-id">candidateList</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a501"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a502"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$matches&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$item</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a503"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$tag&nbsp;</span>=&nbsp;<span class="src-var">$item</span><span class="src-sym">-&gt;</span><span class="src-id">tagName</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a504"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$f&nbsp;</span>=&nbsp;<a href="http://www.php.net/strtolower">strtolower</a><span class="src-sym">(</span><a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-var">$tag</span><span class="src-sym">,&nbsp;</span><span class="src-num">0</span><span class="src-sym">,&nbsp;</span><span class="src-num">1</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a505"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$f&nbsp;</span>==&nbsp;<span class="src-str">'h'&nbsp;</span>&amp;&amp;&nbsp;<a href="http://www.php.net/strlen">strlen</a><span class="src-sym">(</span><span class="src-var">$tag</span><span class="src-sym">)&nbsp;</span>==&nbsp;<span class="src-num">2&nbsp;</span>&amp;&amp;&nbsp;<a href="http://www.php.net/ctype_digit">ctype_digit</a><span class="src-sym">(</span><a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-var">$tag</span><span class="src-sym">,&nbsp;</span><span class="src-num">1</span><span class="src-sym">,&nbsp;</span><span class="src-num">1</span><span class="src-sym">)))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a506"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$item</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a507"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a508"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a509"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-id"><a href="../QueryPath/CSSParser/UniqueElementList.html">UniqueElementList</a></span><span class="src-sym">::</span><a href="../QueryPath/CSSParser/UniqueElementList.html#methodget">get</a><span class="src-sym">(</span><span class="src-var">$found</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a510"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a511"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'has'</span>:</div></li>
<li><div class="src-line"><a name="a512"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodhas">has</a><span class="src-sym">(</span><span class="src-var">$value</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a513"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a514"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Contains&nbsp;==&nbsp;text&nbsp;matches.</span></div></li>
<li><div class="src-line"><a name="a515"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'contains'</span>:</div></li>
<li><div class="src-line"><a name="a516"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$matches&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-id">candidateList</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a517"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a518"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$matches&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$item</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a519"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$item</span><span class="src-sym">-&gt;</span><span class="src-id">textContent&nbsp;</span>==&nbsp;<span class="src-var">$value</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a520"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$item</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a521"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a522"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a523"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-var">$found</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a524"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a525"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">default</span>:</div></li>
<li><div class="src-line"><a name="a526"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id">CssParseException</span><span class="src-sym">(</span><span class="src-str">&quot;Unknown&nbsp;Pseudo-Class:&nbsp;&quot;&nbsp;</span>.&nbsp;<span class="src-var">$name</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a527"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a528"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$findAnyElement">findAnyElement</a>&nbsp;=&nbsp;<span class="src-id">FALSE</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a529"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a530"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a531"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a532"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;Pseudo-class&nbsp;handler&nbsp;for&nbsp;a&nbsp;variety&nbsp;of&nbsp;jQuery&nbsp;pseudo-classes.</span></div></li>
<li><div class="src-line"><a name="a533"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;Handles&nbsp;lt,&nbsp;gt,&nbsp;eq,&nbsp;nth,&nbsp;first,&nbsp;last&nbsp;pseudo-classes.</span></div></li>
<li><div class="src-line"><a name="a534"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a535"></a>&nbsp;&nbsp;<span class="src-key">private&nbsp;</span><span class="src-key">function&nbsp;</span><span class="src-id">getByPosition</span><span class="src-sym">(</span><span class="src-var">$operator</span><span class="src-sym">,&nbsp;</span><span class="src-var">$pos</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a536"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$matches&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-id">candidateList</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a537"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a538"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$matches</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a539"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a540"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a541"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a542"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">switch&nbsp;</span><span class="src-sym">(</span><span class="src-var">$operator</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a543"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'nth'</span>:</div></li>
<li><div class="src-line"><a name="a544"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'eq'</span>:</div></li>
<li><div class="src-line"><a name="a545"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><a href="http://www.php.net/count">count</a><span class="src-sym">(</span><span class="src-var">$matches</span><span class="src-sym">)&nbsp;</span>&gt;=&nbsp;<span class="src-var">$pos</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a546"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$matches</span><span class="src-sym">[</span><span class="src-var">$pos&nbsp;</span>-<span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a547"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a548"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a549"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'first'</span>:</div></li>
<li><div class="src-line"><a name="a550"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$matches</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a551"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a552"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'last'</span>:</div></li>
<li><div class="src-line"><a name="a553"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$matches</span><span class="src-sym">[</span><a href="http://www.php.net/count">count</a><span class="src-sym">(</span><span class="src-var">$matches</span><span class="src-sym">)&nbsp;</span>-&nbsp;<span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a554"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a555"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;case&nbsp;'even':&nbsp;</span></div></li>
<li><div class="src-line"><a name="a556"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for&nbsp;($i&nbsp;=&nbsp;1;&nbsp;$i&nbsp;&lt;=&nbsp;count($matches);&nbsp;++$i)&nbsp;{</span></div></li>
<li><div class="src-line"><a name="a557"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($i&nbsp;%&nbsp;2&nbsp;==&nbsp;0)&nbsp;{</span></div></li>
<li><div class="src-line"><a name="a558"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$found[]&nbsp;=&nbsp;$matches[$i];</span></div></li>
<li><div class="src-line"><a name="a559"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></div></li>
<li><div class="src-line"><a name="a560"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></div></li>
<li><div class="src-line"><a name="a561"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;</span></div></li>
<li><div class="src-line"><a name="a562"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case&nbsp;'odd':</span></div></li>
<li><div class="src-line"><a name="a563"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for&nbsp;($i&nbsp;=&nbsp;1;&nbsp;$i&nbsp;&lt;=&nbsp;count($matches);&nbsp;++$i)&nbsp;{</span></div></li>
<li><div class="src-line"><a name="a564"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($i&nbsp;%&nbsp;2&nbsp;==&nbsp;0)&nbsp;{</span></div></li>
<li><div class="src-line"><a name="a565"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$found[]&nbsp;=&nbsp;$matches[$i];</span></div></li>
<li><div class="src-line"><a name="a566"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></div></li>
<li><div class="src-line"><a name="a567"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></div></li>
<li><div class="src-line"><a name="a568"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;</span></div></li>
<li><div class="src-line"><a name="a569"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'lt'</span>:</div></li>
<li><div class="src-line"><a name="a570"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">for&nbsp;</span><span class="src-sym">(</span><span class="src-var">$i&nbsp;</span>=&nbsp;<span class="src-num">1</span><span class="src-sym">;&nbsp;</span><span class="src-var">$i&nbsp;</span>&lt;=&nbsp;<a href="http://www.php.net/count">count</a><span class="src-sym">(</span><span class="src-var">$matches</span><span class="src-sym">)</span><span class="src-sym">;&nbsp;</span>++<span class="src-var">$i</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a571"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$i&nbsp;</span>&lt;&nbsp;<span class="src-var">$pos</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a572"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$matches</span><span class="src-sym">[</span><span class="src-var">$i</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a573"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a574"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a575"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a576"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'gt'</span>:</div></li>
<li><div class="src-line"><a name="a577"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">for&nbsp;</span><span class="src-sym">(</span><span class="src-var">$i&nbsp;</span>=&nbsp;<span class="src-num">1</span><span class="src-sym">;&nbsp;</span><span class="src-var">$i&nbsp;</span>&lt;=&nbsp;<a href="http://www.php.net/count">count</a><span class="src-sym">(</span><span class="src-var">$matches</span><span class="src-sym">)</span><span class="src-sym">;&nbsp;</span>++<span class="src-var">$i</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a578"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$i&nbsp;</span>&gt;&nbsp;<span class="src-var">$pos</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a579"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$matches</span><span class="src-sym">[</span><span class="src-var">$i</span>-<span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a580"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a581"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a582"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a583"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a584"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a585"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-var">$found</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a586"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a587"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a588"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a589"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;Parse&nbsp;an&nbsp;an+b&nbsp;rule&nbsp;for&nbsp;CSS&nbsp;pseudo-classes.</span></div></li>
<li><div class="src-line"><a name="a590"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc-type">$rule&nbsp;</span></div></li>
<li><div class="src-line"><a name="a591"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;</span><span class="src-doc">Some&nbsp;rule&nbsp;in&nbsp;the&nbsp;an+b&nbsp;format.</span></div></li>
<li><div class="src-line"><a name="a592"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@return&nbsp;</span></div></li>
<li><div class="src-line"><a name="a593"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;Array&nbsp;(list($aVal,&nbsp;$bVal))&nbsp;of&nbsp;the&nbsp;two&nbsp;values.</span></div></li>
<li><div class="src-line"><a name="a594"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@throws</span><span class="src-doc">&nbsp;CssParseException</span></div></li>
<li><div class="src-line"><a name="a595"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;If&nbsp;the&nbsp;rule&nbsp;does&nbsp;not&nbsp;follow&nbsp;conventions.</span></div></li>
<li><div class="src-line"><a name="a596"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a597"></a>&nbsp;&nbsp;<span class="src-key">protected&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodparseAnB">parseAnB</a><span class="src-sym">(</span><span class="src-var">$rule</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a598"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$rule&nbsp;</span>==&nbsp;<span class="src-str">'even'</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a599"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-num">2</span><span class="src-sym">,&nbsp;</span><span class="src-num">0</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a600"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a601"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">elseif&nbsp;</span><span class="src-sym">(</span><span class="src-var">$rule&nbsp;</span>==&nbsp;<span class="src-str">'odd'</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a602"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-num">2</span><span class="src-sym">,&nbsp;</span><span class="src-num">1</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a603"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a604"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">elseif&nbsp;</span><span class="src-sym">(</span><span class="src-var">$rule&nbsp;</span>==&nbsp;<span class="src-str">'n'</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a605"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-num">1</span><span class="src-sym">,&nbsp;</span><span class="src-num">0</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a606"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a607"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">elseif&nbsp;</span><span class="src-sym">(</span><a href="http://www.php.net/is_numeric">is_numeric</a><span class="src-sym">(</span><span class="src-var">$rule</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a608"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-num">0</span><span class="src-sym">,&nbsp;</span>(int)<span class="src-var">$rule</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a609"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a610"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a611"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$rule&nbsp;</span>=&nbsp;<a href="http://www.php.net/explode">explode</a><span class="src-sym">(</span><span class="src-str">'n'</span><span class="src-sym">,&nbsp;</span><span class="src-var">$rule</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a612"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><a href="http://www.php.net/count">count</a><span class="src-sym">(</span><span class="src-var">$rule</span><span class="src-sym">)&nbsp;</span>==&nbsp;<span class="src-num">0</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a613"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id">CssParseException</span><span class="src-sym">(</span><span class="src-str">&quot;nth-child&nbsp;value&nbsp;is&nbsp;invalid.&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a614"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a615"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$aVal&nbsp;</span>=&nbsp;(int)<a href="http://www.php.net/trim">trim</a><span class="src-sym">(</span><span class="src-var">$rule</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a616"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$bVal&nbsp;</span>=&nbsp;<span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$rule</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">)&nbsp;</span>?&nbsp;(int)<a href="http://www.php.net/trim">trim</a><span class="src-sym">(</span><span class="src-var">$rule</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">)&nbsp;</span>:&nbsp;<span class="src-num">0</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a617"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-var">$aVal</span><span class="src-sym">,&nbsp;</span><span class="src-var">$bVal</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a618"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a619"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a620"></a>&nbsp;&nbsp;<span class="src-key">protected&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodnthChild">nthChild</a><span class="src-sym">(</span><span class="src-var">$groupSize</span><span class="src-sym">,&nbsp;</span><span class="src-var">$elementInGroup</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a621"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;BEGIN&nbsp;implementing&nbsp;jQuery&nbsp;algo&nbsp;for&nbsp;this:</span></div></li>
<li><div class="src-line"><a name="a622"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;This&nbsp;might&nbsp;be&nbsp;more&nbsp;compact,&nbsp;but&nbsp;it&nbsp;has&nbsp;at&nbsp;least&nbsp;one</span></div></li>
<li><div class="src-line"><a name="a623"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;E_STRICT&nbsp;violation&nbsp;(creating&nbsp;object&nbsp;properties&nbsp;on&nbsp;the&nbsp;fly),</span></div></li>
<li><div class="src-line"><a name="a624"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;and&nbsp;it&nbsp;may&nbsp;not&nbsp;be&nbsp;as&nbsp;fast&nbsp;in&nbsp;PHP,&nbsp;since&nbsp;most&nbsp;of&nbsp;the&nbsp;descent</span></div></li>
<li><div class="src-line"><a name="a625"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;processing&nbsp;is&nbsp;handled&nbsp;in&nbsp;PHP&nbsp;instead&nbsp;of&nbsp;in&nbsp;C.</span></div></li>
<li><div class="src-line"><a name="a626"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$merge&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a627"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$tmp&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a628"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$first&nbsp;</span>=&nbsp;<span class="src-var">$groupSize</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a629"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$last&nbsp;</span>=&nbsp;<span class="src-var">$elementInGroup</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a630"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$r&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a631"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a632"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">for</span><span class="src-sym">(</span><span class="src-var">$i&nbsp;</span>=&nbsp;<span class="src-num">0</span><span class="src-sym">;&nbsp;</span><span class="src-var">$i&nbsp;</span>&lt;&nbsp;<a href="http://www.php.net/count">count</a><span class="src-sym">(</span><span class="src-var">$r</span><span class="src-sym">)</span><span class="src-sym">;&nbsp;</span><span class="src-var">$i</span>++<span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a633"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$node&nbsp;</span>=&nbsp;<span class="src-var">$r</span><span class="src-sym">[</span><span class="src-var">$i</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a634"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$parentNode&nbsp;</span>=&nbsp;<span class="src-var">$node</span><span class="src-sym">-&gt;</span><span class="src-id">parentNode</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a635"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$id&nbsp;</span>=&nbsp;<a href="http://www.php.net/md5">md5</a><span class="src-sym">(</span><a href="http://www.php.net/serialize">serialize</a><span class="src-sym">(</span><span class="src-var">$parentNode</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a636"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$nodeIndex&nbsp;</span>=&nbsp;<span class="src-id">NULL</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a637"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a638"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$merge</span><span class="src-sym">[</span><span class="src-var">$id</span><span class="src-sym">]</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a639"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$c&nbsp;</span>=&nbsp;<span class="src-num">1</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a640"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a641"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">for&nbsp;</span><span class="src-sym">(</span><span class="src-var">$n&nbsp;</span>=&nbsp;<span class="src-var">$parentNode</span><span class="src-sym">-&gt;</span><span class="src-id">firstChild</span><span class="src-sym">;&nbsp;</span><span class="src-var">$n</span><span class="src-sym">;&nbsp;</span><span class="src-var">$n&nbsp;</span>=&nbsp;<span class="src-var">$n</span><span class="src-sym">-&gt;</span><span class="src-id">nextSibling</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a642"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$n</span><span class="src-sym">-&gt;</span><span class="src-id">nodeType&nbsp;</span>==&nbsp;<span class="src-id">XML_ELEMENT_NODE</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a643"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$n</span><span class="src-sym">-&gt;</span><span class="src-id">nodeIndex&nbsp;</span>=&nbsp;<span class="src-var">$c</span>++<span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a644"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a645"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a646"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a647"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$merge</span><span class="src-sym">[</span><span class="src-var">$id</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-id">TRUE</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a648"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a649"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a650"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$add&nbsp;</span>=&nbsp;<span class="src-id">FALSE</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a651"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a652"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$first&nbsp;</span>==&nbsp;<span class="src-num">0</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a653"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$node</span><span class="src-sym">-&gt;</span><span class="src-id">nodeIndex&nbsp;</span>==&nbsp;<span class="src-var">$last</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a654"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$add&nbsp;</span>=&nbsp;<span class="src-id">TRUE</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a655"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a656"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a657"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">elseif&nbsp;</span><span class="src-sym">((</span><span class="src-var">$node</span><span class="src-sym">-&gt;</span><span class="src-id">nodeIndex&nbsp;</span>-&nbsp;<span class="src-var">$last</span><span class="src-sym">)&nbsp;</span>%&nbsp;<span class="src-var">$first&nbsp;</span>==&nbsp;<span class="src-num">0&nbsp;</span>&amp;&amp;&nbsp;<span class="src-sym">(</span><span class="src-var">$node</span><span class="src-sym">-&gt;</span><span class="src-id">nodeIndex&nbsp;</span>-&nbsp;<span class="src-var">$last</span><span class="src-sym">)&nbsp;</span>/&nbsp;<span class="src-var">$first&nbsp;</span>&gt;=&nbsp;<span class="src-num">0</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a658"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$add&nbsp;</span>=&nbsp;<span class="src-id">TRUE</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a659"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a660"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a661"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$add</span><span class="src-comm">/*&nbsp;^&nbsp;$not*/</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a662"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$tmp</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$node</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a663"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a664"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a665"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a666"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-var">$tmp</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a667"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;END&nbsp;jQuery&nbsp;algo</span></div></li>
<li><div class="src-line"><a name="a668"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a669"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">/*</span></div></li>
<li><div class="src-line"><a name="a670"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Orig:</span></div></li>
<li><div class="src-line"><a name="a671"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a672"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;If&nbsp;findAnyElement&nbsp;is&nbsp;true,&nbsp;then&nbsp;we&nbsp;</span></div></li>
<li><div class="src-line"><a name="a673"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;know&nbsp;that&nbsp;there&nbsp;was&nbsp;no&nbsp;element&nbsp;selector</span></div></li>
<li><div class="src-line"><a name="a674"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;preceding&nbsp;this.</span></div></li>
<li><div class="src-line"><a name="a675"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;$restrictToElement&nbsp;=&nbsp;!$this-&gt;findAnyElement;</span></div></li>
<li><div class="src-line"><a name="a676"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a677"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;$found&nbsp;=&nbsp;array();</span></div></li>
<li><div class="src-line"><a name="a678"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;$groupSize&nbsp;=&nbsp;abs($groupSize);</span></div></li>
<li><div class="src-line"><a name="a679"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($elementInGroup&nbsp;&lt;&nbsp;0)&nbsp;{</span></div></li>
<li><div class="src-line"><a name="a680"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;in&nbsp;an-b,&nbsp;element&nbsp;in&nbsp;group&nbsp;is&nbsp;effectively&nbsp;a-b.</span></div></li>
<li><div class="src-line"><a name="a681"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$elementInGroup&nbsp;=&nbsp;$groupSize&nbsp;+&nbsp;$elementInGroup;</span></div></li>
<li><div class="src-line"><a name="a682"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;}</span></div></li>
<li><div class="src-line"><a name="a683"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($groupSize&nbsp;==&nbsp;0)&nbsp;{</span></div></li>
<li><div class="src-line"><a name="a684"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($elementInGroup&nbsp;==&nbsp;0&nbsp;)&nbsp;{</span></div></li>
<li><div class="src-line"><a name="a685"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Both&nbsp;==&nbsp;0&nbsp;means&nbsp;no&nbsp;matches:</span></div></li>
<li><div class="src-line"><a name="a686"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;matches&nbsp;=&nbsp;array();</span></div></li>
<li><div class="src-line"><a name="a687"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return;</span></div></li>
<li><div class="src-line"><a name="a688"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></div></li>
<li><div class="src-line"><a name="a689"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else&nbsp;{</span></div></li>
<li><div class="src-line"><a name="a690"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Return&nbsp;only&nbsp;one&nbsp;element&nbsp;per&nbsp;list:</span></div></li>
<li><div class="src-line"><a name="a691"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$matches&nbsp;=&nbsp;$this-&gt;candidateList();</span></div></li>
<li><div class="src-line"><a name="a692"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach&nbsp;($matches&nbsp;as&nbsp;$item)&nbsp;{</span></div></li>
<li><div class="src-line"><a name="a693"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$kids&nbsp;=&nbsp;$this-&gt;listPeerElements($item,&nbsp;$restrictToElement);</span></div></li>
<li><div class="src-line"><a name="a694"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(count($kids)&nbsp;&gt;=&nbsp;$elementInGroup)&nbsp;{</span></div></li>
<li><div class="src-line"><a name="a695"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Correct&nbsp;for&nbsp;offset:&nbsp;CSS&nbsp;spec&nbsp;says&nbsp;list&nbsp;begins&nbsp;with</span></div></li>
<li><div class="src-line"><a name="a696"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;1,&nbsp;not&nbsp;0.</span></div></li>
<li><div class="src-line"><a name="a697"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$found[]&nbsp;=&nbsp;$kids[$elementInGroup&nbsp;-1];</span></div></li>
<li><div class="src-line"><a name="a698"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></div></li>
<li><div class="src-line"><a name="a699"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></div></li>
<li><div class="src-line"><a name="a700"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;matches&nbsp;=&nbsp;UniqueElementList::get($found);</span></div></li>
<li><div class="src-line"><a name="a701"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return;</span></div></li>
<li><div class="src-line"><a name="a702"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></div></li>
<li><div class="src-line"><a name="a703"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;}</span></div></li>
<li><div class="src-line"><a name="a704"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;//print&nbsp;__FUNCTION__&nbsp;.&nbsp;&quot;&nbsp;size:&nbsp;$groupSize,&nbsp;$elementInGroup.\n&quot;;</span></div></li>
<li><div class="src-line"><a name="a705"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a706"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;$matches&nbsp;=&nbsp;$this-&gt;candidateList();</span></div></li>
<li><div class="src-line"><a name="a707"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;$alreadyChecked&nbsp;=&nbsp;array();</span></div></li>
<li><div class="src-line"><a name="a708"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a709"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Handle&nbsp;only&nbsp;the&nbsp;immediate&nbsp;elements</span></div></li>
<li><div class="src-line"><a name="a710"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($restrictToElement)&nbsp;{</span></div></li>
<li><div class="src-line"><a name="a711"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach($matches&nbsp;as&nbsp;$item)&nbsp;{</span></div></li>
<li><div class="src-line"><a name="a712"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$parent&nbsp;=&nbsp;$item-&gt;parentNode;</span></div></li>
<li><div class="src-line"><a name="a713"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$i&nbsp;=&nbsp;1;</span></div></li>
<li><div class="src-line"><a name="a714"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach&nbsp;($parent-&gt;childNodes&nbsp;as&nbsp;$node)&nbsp;{</span></div></li>
<li><div class="src-line"><a name="a715"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($node-&gt;nodeType&nbsp;==&nbsp;XML_ELEMENT_NODE&nbsp;&amp;&amp;&nbsp;$node-&gt;tagName&nbsp;==&nbsp;$item-&gt;tagName)&nbsp;{</span></div></li>
<li><div class="src-line"><a name="a716"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($i&nbsp;%&nbsp;$groupSize&nbsp;==&nbsp;$elementInGroup)&nbsp;{</span></div></li>
<li><div class="src-line"><a name="a717"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//if&nbsp;($node-&gt;nodeIndex&nbsp;-&nbsp;$elementInGroup&nbsp;%&nbsp;$groupSize&nbsp;==&nbsp;0)&nbsp;{</span></div></li>
<li><div class="src-line"><a name="a718"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;&quot;Found&nbsp;&quot;&nbsp;.&nbsp;$node-&gt;getAttribute('id')&nbsp;.&nbsp;PHP_EOL;</span></div></li>
<li><div class="src-line"><a name="a719"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$found[]&nbsp;=&nbsp;$node;</span></div></li>
<li><div class="src-line"><a name="a720"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></div></li>
<li><div class="src-line"><a name="a721"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;++$i;&nbsp;//&nbsp;Only&nbsp;increment&nbsp;for&nbsp;matches.</span></div></li>
<li><div class="src-line"><a name="a722"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></div></li>
<li><div class="src-line"><a name="a723"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></div></li>
<li><div class="src-line"><a name="a724"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></div></li>
<li><div class="src-line"><a name="a725"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$found&nbsp;=&nbsp;UniqueElementList::get($found);</span></div></li>
<li><div class="src-line"><a name="a726"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;}</span></div></li>
<li><div class="src-line"><a name="a727"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Handle&nbsp;any&nbsp;child&nbsp;elements.&nbsp;Since&nbsp;no&nbsp;element&nbsp;selector</span></div></li>
<li><div class="src-line"><a name="a728"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;is&nbsp;effective,&nbsp;then&nbsp;elements&nbsp;of&nbsp;any&nbsp;tag&nbsp;name&nbsp;are&nbsp;considered</span></div></li>
<li><div class="src-line"><a name="a729"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;to&nbsp;be&nbsp;matches.</span></div></li>
<li><div class="src-line"><a name="a730"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;else&nbsp;{</span></div></li>
<li><div class="src-line"><a name="a731"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach&nbsp;($matches&nbsp;as&nbsp;$item)&nbsp;{</span></div></li>
<li><div class="src-line"><a name="a732"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$parent&nbsp;=&nbsp;$item-&gt;parentNode;</span></div></li>
<li><div class="src-line"><a name="a733"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(in_array($parent,&nbsp;$alreadyChecked))&nbsp;{</span></div></li>
<li><div class="src-line"><a name="a734"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Skip&nbsp;this.&nbsp;It's&nbsp;been&nbsp;done&nbsp;already.</span></div></li>
<li><div class="src-line"><a name="a735"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;</span></div></li>
<li><div class="src-line"><a name="a736"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></div></li>
<li><div class="src-line"><a name="a737"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$alreadyChecked[]&nbsp;=&nbsp;$parent;</span></div></li>
<li><div class="src-line"><a name="a738"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a739"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$i&nbsp;=&nbsp;1;</span></div></li>
<li><div class="src-line"><a name="a740"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach&nbsp;($parent-&gt;childNodes&nbsp;as&nbsp;$node)&nbsp;{</span></div></li>
<li><div class="src-line"><a name="a741"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($node-&gt;nodeType&nbsp;==&nbsp;XML_ELEMENT_NODE)&nbsp;{</span></div></li>
<li><div class="src-line"><a name="a742"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Do&nbsp;an&nbsp;+&nbsp;b&nbsp;matching</span></div></li>
<li><div class="src-line"><a name="a743"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($i&nbsp;%&nbsp;$groupSize&nbsp;==&nbsp;$elementInGroup)&nbsp;{</span></div></li>
<li><div class="src-line"><a name="a744"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$found[]&nbsp;=&nbsp;$node;</span></div></li>
<li><div class="src-line"><a name="a745"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></div></li>
<li><div class="src-line"><a name="a746"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;++$i;</span></div></li>
<li><div class="src-line"><a name="a747"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></div></li>
<li><div class="src-line"><a name="a748"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></div></li>
<li><div class="src-line"><a name="a749"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;</span></div></li>
<li><div class="src-line"><a name="a750"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;}</span></div></li>
<li><div class="src-line"><a name="a751"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a752"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a753"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;matches&nbsp;=&nbsp;$found;</span></div></li>
<li><div class="src-line"><a name="a754"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a755"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a756"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a757"></a>&nbsp;&nbsp;<span class="src-key">protected&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodnthLastChild">nthLastChild</a><span class="src-sym">(</span><span class="src-var">$groupSize</span><span class="src-sym">,&nbsp;</span><span class="src-var">$elementInGroup</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a758"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;If&nbsp;findAnyElement&nbsp;is&nbsp;true,&nbsp;then&nbsp;we&nbsp;</span></div></li>
<li><div class="src-line"><a name="a759"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;know&nbsp;that&nbsp;there&nbsp;was&nbsp;no&nbsp;element&nbsp;selector</span></div></li>
<li><div class="src-line"><a name="a760"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;preceding&nbsp;this.</span></div></li>
<li><div class="src-line"><a name="a761"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$restrictToElement&nbsp;</span>=&nbsp;<span class="src-sym">!</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$findAnyElement">findAnyElement</a><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a762"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a763"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a764"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//$groupSize&nbsp;=&nbsp;abs($groupSize);</span></div></li>
<li><div class="src-line"><a name="a765"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$elementInGroup&nbsp;</span>&lt;&nbsp;<span class="src-num">0</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a766"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;in&nbsp;an-b,&nbsp;element&nbsp;in&nbsp;group&nbsp;is&nbsp;effectively&nbsp;a-b.</span></div></li>
<li><div class="src-line"><a name="a767"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$elementInGroup&nbsp;</span>=&nbsp;<span class="src-var">$groupSize&nbsp;</span>+&nbsp;<span class="src-var">$elementInGroup</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a768"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a769"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$groupSize&nbsp;</span>==&nbsp;<span class="src-num">0</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a770"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$elementInGroup&nbsp;</span>==&nbsp;<span class="src-num">0&nbsp;</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a771"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Both&nbsp;==&nbsp;0&nbsp;means&nbsp;no&nbsp;matches:</span></div></li>
<li><div class="src-line"><a name="a772"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a773"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a774"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a775"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">else&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a776"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Return&nbsp;only&nbsp;one&nbsp;element&nbsp;per&nbsp;list:</span></div></li>
<li><div class="src-line"><a name="a777"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$matches&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-id">candidateList</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a778"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$matches&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$item</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a779"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$kids&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodlistPeerElements">listPeerElements</a><span class="src-sym">(</span><span class="src-var">$item</span><span class="src-sym">,&nbsp;</span><span class="src-var">$restrictToElement</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a780"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$count&nbsp;</span>=&nbsp;<a href="http://www.php.net/count">count</a><span class="src-sym">(</span><span class="src-var">$kids</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a781"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$count&nbsp;</span>&gt;=&nbsp;<span class="src-var">$elementInGroup</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a782"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Correct&nbsp;for&nbsp;offset:&nbsp;CSS&nbsp;spec&nbsp;says&nbsp;list&nbsp;begins&nbsp;with</span></div></li>
<li><div class="src-line"><a name="a783"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;1,&nbsp;not&nbsp;0.</span></div></li>
<li><div class="src-line"><a name="a784"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$kids</span><span class="src-sym">[</span><span class="src-var">$count&nbsp;</span>-&nbsp;<span class="src-var">$elementInGroup</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a785"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a786"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a787"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-id"><a href="../QueryPath/CSSParser/UniqueElementList.html">UniqueElementList</a></span><span class="src-sym">::</span><a href="../QueryPath/CSSParser/UniqueElementList.html#methodget">get</a><span class="src-sym">(</span><span class="src-var">$found</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a788"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a789"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a790"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a791"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//print&nbsp;__FUNCTION__&nbsp;.&nbsp;&quot;&nbsp;size:&nbsp;$groupSize,&nbsp;$elementInGroup.\n&quot;;</span></div></li>
<li><div class="src-line"><a name="a792"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a793"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$matches&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-id">candidateList</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a794"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$alreadyChecked&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a795"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a796"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">/*</span></div></li>
<li><div class="src-line"><a name="a797"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;The&nbsp;code&nbsp;below&nbsp;needs&nbsp;some&nbsp;cleaning.&nbsp;The&nbsp;original&nbsp;version</span></div></li>
<li><div class="src-line"><a name="a798"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;only&nbsp;worked&nbsp;after&nbsp;an&nbsp;any-descendant&nbsp;operator,&nbsp;as&nbsp;it&nbsp;did&nbsp;</span></div></li>
<li><div class="src-line"><a name="a799"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;not&nbsp;adequately&nbsp;constrain&nbsp;element&nbsp;types.&nbsp;It&nbsp;still&nbsp;exists&nbsp;as-is</span></div></li>
<li><div class="src-line"><a name="a800"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;in&nbsp;the&nbsp;else&nbsp;block.&nbsp;However,&nbsp;the&nbsp;optimization&nbsp;(checking&nbsp;parents)</span></div></li>
<li><div class="src-line"><a name="a801"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;has&nbsp;not&nbsp;been&nbsp;tested.&nbsp;If&nbsp;it&nbsp;is&nbsp;not&nbsp;very&nbsp;effective,&nbsp;then&nbsp;we&nbsp;should</span></div></li>
<li><div class="src-line"><a name="a802"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;figure&nbsp;out&nbsp;a&nbsp;more&nbsp;elegant&nbsp;way&nbsp;to&nbsp;handle&nbsp;this.</span></div></li>
<li><div class="src-line"><a name="a803"></a><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a804"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a805"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Start&nbsp;at&nbsp;the&nbsp;end&nbsp;and&nbsp;go&nbsp;backward.</span></div></li>
<li><div class="src-line"><a name="a806"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$matches&nbsp;</span>=&nbsp;<a href="http://www.php.net/array_reverse">array_reverse</a><span class="src-sym">(</span><span class="src-var">$matches</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a807"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a808"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Handle&nbsp;only&nbsp;the&nbsp;immediate&nbsp;elements</span></div></li>
<li><div class="src-line"><a name="a809"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$restrictToElement</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a810"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach</span><span class="src-sym">(</span><span class="src-var">$matches&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$item</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a811"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$parent&nbsp;</span>=&nbsp;<span class="src-var">$item</span><span class="src-sym">-&gt;</span><span class="src-id">parentNode</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a812"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$i&nbsp;</span>=&nbsp;<span class="src-num">1</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a813"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">for&nbsp;</span><span class="src-sym">(</span><span class="src-var">$j&nbsp;</span>=&nbsp;<span class="src-var">$parent</span><span class="src-sym">-&gt;</span><span class="src-id">childNodes</span><span class="src-sym">-&gt;</span><span class="src-id">length&nbsp;</span>-&nbsp;<span class="src-num">1</span><span class="src-sym">;&nbsp;</span><span class="src-var">$j&nbsp;</span>&gt;&nbsp;<span class="src-num">0</span><span class="src-sym">;&nbsp;</span>--<span class="src-var">$j</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a814"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$node&nbsp;</span>=&nbsp;<span class="src-var">$parent</span><span class="src-sym">-&gt;</span><span class="src-id">childNodes</span><span class="src-sym">-&gt;</span><span class="src-id">item</span><span class="src-sym">(</span><span class="src-var">$j</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a815"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$node</span><span class="src-sym">-&gt;</span><span class="src-id">nodeType&nbsp;</span>==&nbsp;<span class="src-id">XML_ELEMENT_NODE&nbsp;</span>&amp;&amp;&nbsp;<span class="src-var">$node</span><span class="src-sym">-&gt;</span><span class="src-id">tagName&nbsp;</span>==&nbsp;<span class="src-var">$item</span><span class="src-sym">-&gt;</span><span class="src-id">tagName</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a816"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$i&nbsp;</span>%&nbsp;<span class="src-var">$groupSize&nbsp;</span>==&nbsp;<span class="src-var">$elementInGroup</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a817"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$node</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a818"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a819"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;++<span class="src-var">$i</span><span class="src-sym">;&nbsp;</span><span class="src-comm">//&nbsp;Only&nbsp;increment&nbsp;for&nbsp;matches.</span></div></li>
<li><div class="src-line"><a name="a820"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a821"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a822"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a823"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;There&nbsp;are&nbsp;no&nbsp;notes&nbsp;that&nbsp;say&nbsp;whether&nbsp;what&nbsp;order&nbsp;the&nbsp;results</span></div></li>
<li><div class="src-line"><a name="a824"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;shold&nbsp;be&nbsp;retrned&nbsp;in.&nbsp;Should&nbsp;this&nbsp;be&nbsp;reversed&nbsp;again?</span></div></li>
<li><div class="src-line"><a name="a825"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found&nbsp;</span>=&nbsp;<span class="src-id"><a href="../QueryPath/CSSParser/UniqueElementList.html">UniqueElementList</a></span><span class="src-sym">::</span><a href="../QueryPath/CSSParser/UniqueElementList.html#methodget">get</a><span class="src-sym">(</span><span class="src-var">$found</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a826"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a827"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Handle&nbsp;any&nbsp;child&nbsp;elements.&nbsp;Since&nbsp;no&nbsp;element&nbsp;selector</span></div></li>
<li><div class="src-line"><a name="a828"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;is&nbsp;effective,&nbsp;then&nbsp;elements&nbsp;of&nbsp;any&nbsp;tag&nbsp;name&nbsp;are&nbsp;considered</span></div></li>
<li><div class="src-line"><a name="a829"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;to&nbsp;be&nbsp;matches.</span></div></li>
<li><div class="src-line"><a name="a830"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">else&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a831"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$matches&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$item</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a832"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$parent&nbsp;</span>=&nbsp;<span class="src-var">$item</span><span class="src-sym">-&gt;</span><span class="src-id">parentNode</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a833"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><a href="http://www.php.net/in_array">in_array</a><span class="src-sym">(</span><span class="src-var">$parent</span><span class="src-sym">,&nbsp;</span><span class="src-var">$alreadyChecked</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a834"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Skip&nbsp;this.&nbsp;It's&nbsp;been&nbsp;done&nbsp;already.</span></div></li>
<li><div class="src-line"><a name="a835"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a836"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a837"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$alreadyChecked</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$parent</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a838"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a839"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$i&nbsp;</span>=&nbsp;<span class="src-num">1</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a840"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a841"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">for&nbsp;</span><span class="src-sym">(</span><span class="src-var">$j&nbsp;</span>=&nbsp;<span class="src-var">$parent</span><span class="src-sym">-&gt;</span><span class="src-id">childNodes</span><span class="src-sym">-&gt;</span><span class="src-id">length&nbsp;</span>-&nbsp;<span class="src-num">1</span><span class="src-sym">;&nbsp;</span><span class="src-var">$j&nbsp;</span>&gt;=&nbsp;<span class="src-num">0</span><span class="src-sym">;&nbsp;</span>++<span class="src-var">$j</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a842"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$node&nbsp;</span>=&nbsp;<span class="src-var">$parent</span><span class="src-sym">-&gt;</span><span class="src-id">childNodes</span><span class="src-sym">-&gt;</span><span class="src-id">item</span><span class="src-sym">(</span><span class="src-var">$j</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a843"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$node</span><span class="src-sym">-&gt;</span><span class="src-id">nodeType&nbsp;</span>==&nbsp;<span class="src-id">XML_ELEMENT_NODE</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a844"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Do&nbsp;an&nbsp;+&nbsp;b&nbsp;matching</span></div></li>
<li><div class="src-line"><a name="a845"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$i&nbsp;</span>%&nbsp;<span class="src-var">$groupSize&nbsp;</span>==&nbsp;<span class="src-var">$elementInGroup</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a846"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$node</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a847"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a848"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;++<span class="src-var">$i</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a849"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a850"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a851"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}&nbsp;&nbsp;</span></div></li>
<li><div class="src-line"><a name="a852"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a853"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a854"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a855"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-var">$found</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a856"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a857"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a858"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a859"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a860"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;Get&nbsp;a&nbsp;list&nbsp;of&nbsp;peer&nbsp;elements.</span></div></li>
<li><div class="src-line"><a name="a861"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;If&nbsp;$requireSameTag&nbsp;is&nbsp;TRUE,&nbsp;then&nbsp;only&nbsp;peer&nbsp;elements&nbsp;with&nbsp;the&nbsp;same</span></div></li>
<li><div class="src-line"><a name="a862"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;tagname&nbsp;as&nbsp;the&nbsp;given&nbsp;element&nbsp;will&nbsp;be&nbsp;returned.</span></div></li>
<li><div class="src-line"><a name="a863"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a864"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc-type">$element&nbsp;</span></div></li>
<li><div class="src-line"><a name="a865"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;</span><span class="src-doc">A&nbsp;DomElement.</span></div></li>
<li><div class="src-line"><a name="a866"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc-type">$requireSameTag&nbsp;</span></div></li>
<li><div class="src-line"><a name="a867"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;</span><span class="src-doc">Boolean&nbsp;flag&nbsp;indicating&nbsp;whether&nbsp;all&nbsp;matches&nbsp;should&nbsp;have&nbsp;the&nbsp;same</span></div></li>
<li><div class="src-line"><a name="a868"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;element&nbsp;name&nbsp;(tagName)&nbsp;as&nbsp;$element.</span></div></li>
<li><div class="src-line"><a name="a869"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@return&nbsp;</span></div></li>
<li><div class="src-line"><a name="a870"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;Array&nbsp;of&nbsp;peer&nbsp;elements.</span></div></li>
<li><div class="src-line"><a name="a871"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a872"></a>&nbsp;&nbsp;<span class="src-key">protected&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodlistPeerElements">listPeerElements</a><span class="src-sym">(</span><span class="src-var">$element</span><span class="src-sym">,&nbsp;</span><span class="src-var">$requireSameTag&nbsp;</span>=&nbsp;<span class="src-id">FALSE</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a873"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$peers&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a874"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$parent&nbsp;</span>=&nbsp;<span class="src-var">$element</span><span class="src-sym">-&gt;</span><span class="src-id">parentNode</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a875"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$parent</span><span class="src-sym">-&gt;</span><span class="src-id">childNodes&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$node</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a876"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$node</span><span class="src-sym">-&gt;</span><span class="src-id">nodeType&nbsp;</span>==&nbsp;<span class="src-id">XML_ELEMENT_NODE</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a877"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$requireSameTag</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a878"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Need&nbsp;to&nbsp;make&nbsp;sure&nbsp;that&nbsp;the&nbsp;tag&nbsp;matches:</span></div></li>
<li><div class="src-line"><a name="a879"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$element</span><span class="src-sym">-&gt;</span><span class="src-id">tagName&nbsp;</span>==&nbsp;<span class="src-var">$node</span><span class="src-sym">-&gt;</span><span class="src-id">tagName</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a880"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$peers</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$node</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a881"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a882"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a883"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">else&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a884"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$peers</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$node</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a885"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a886"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a887"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a888"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Return&nbsp;unique&nbsp;element&nbsp;list.</span></div></li>
<li><div class="src-line"><a name="a889"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//return&nbsp;UniqueElementList::get($peers);</span></div></li>
<li><div class="src-line"><a name="a890"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$peers</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a891"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a892"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a893"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a894"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;Get&nbsp;the&nbsp;nth&nbsp;child&nbsp;(by&nbsp;index)&nbsp;from&nbsp;matching&nbsp;candidates.</span></div></li>
<li><div class="src-line"><a name="a895"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a896"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;This&nbsp;is&nbsp;used&nbsp;by&nbsp;pseudo-class&nbsp;handlers.</span></div></li>
<li><div class="src-line"><a name="a897"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a898"></a>&nbsp;&nbsp;<span class="src-key">protected&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodchildAtIndex">childAtIndex</a><span class="src-sym">(</span><span class="src-var">$index</span><span class="src-sym">,&nbsp;</span><span class="src-var">$tagName&nbsp;</span>=&nbsp;<span class="src-id">NULL</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a899"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$restrictToElement&nbsp;</span>=&nbsp;<span class="src-sym">!</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$findAnyElement">findAnyElement</a><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a900"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$matches&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-id">candidateList</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a901"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$defaultTagName&nbsp;</span>=&nbsp;<span class="src-var">$tagName</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a902"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a903"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$matches&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$item</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a904"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$parent&nbsp;</span>=&nbsp;<span class="src-var">$item</span><span class="src-sym">-&gt;</span><span class="src-id">parentNode</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a905"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a906"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;If&nbsp;a&nbsp;default&nbsp;tag&nbsp;name&nbsp;is&nbsp;supplied,&nbsp;we&nbsp;always&nbsp;use&nbsp;it.</span></div></li>
<li><div class="src-line"><a name="a907"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$defaultTagName</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a908"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$tagName&nbsp;</span>=&nbsp;<span class="src-var">$defaultTagName</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a909"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a910"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;If&nbsp;we&nbsp;are&nbsp;inside&nbsp;of&nbsp;an&nbsp;element&nbsp;selector,&nbsp;we&nbsp;use&nbsp;the&nbsp;</span></div></li>
<li><div class="src-line"><a name="a911"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;tag&nbsp;name&nbsp;of&nbsp;the&nbsp;given&nbsp;elements.</span></div></li>
<li><div class="src-line"><a name="a912"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">elseif&nbsp;</span><span class="src-sym">(</span><span class="src-var">$restrictToElement</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a913"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$tagName&nbsp;</span>=&nbsp;<span class="src-var">$item</span><span class="src-sym">-&gt;</span><span class="src-id">tagName</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a914"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a915"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Otherwise,&nbsp;we&nbsp;skip&nbsp;the&nbsp;tag&nbsp;name&nbsp;match.</span></div></li>
<li><div class="src-line"><a name="a916"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">else&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a917"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$tagName&nbsp;</span>=&nbsp;<span class="src-id">NULL</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a918"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a919"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a920"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Loop&nbsp;through&nbsp;all&nbsp;children&nbsp;looking&nbsp;for&nbsp;matches.</span></div></li>
<li><div class="src-line"><a name="a921"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$i&nbsp;</span>=&nbsp;<span class="src-num">0</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a922"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$parent</span><span class="src-sym">-&gt;</span><span class="src-id">childNodes&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$child</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a923"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$child</span><span class="src-sym">-&gt;</span><span class="src-id">nodeType&nbsp;</span>!==&nbsp;<span class="src-id">XML_ELEMENT_NODE</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a924"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;&nbsp;</span><span class="src-comm">//&nbsp;Skip&nbsp;non-elements</span></div></li>
<li><div class="src-line"><a name="a925"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a926"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a927"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;If&nbsp;type&nbsp;is&nbsp;set,&nbsp;then&nbsp;we&nbsp;do&nbsp;type&nbsp;comparison</span></div></li>
<li><div class="src-line"><a name="a928"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$tagName</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a929"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Check&nbsp;whether&nbsp;tag&nbsp;name&nbsp;matches&nbsp;the&nbsp;type.</span></div></li>
<li><div class="src-line"><a name="a930"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$child</span><span class="src-sym">-&gt;</span><span class="src-id">tagName&nbsp;</span>==&nbsp;<span class="src-var">$tagName</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a931"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;See&nbsp;if&nbsp;this&nbsp;is&nbsp;the&nbsp;index&nbsp;we&nbsp;are&nbsp;looking&nbsp;for.</span></div></li>
<li><div class="src-line"><a name="a932"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$i&nbsp;</span>==&nbsp;<span class="src-var">$index</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a933"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-var">$child</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a934"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a935"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a936"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;If&nbsp;it's&nbsp;not&nbsp;the&nbsp;one&nbsp;we&nbsp;are&nbsp;looking&nbsp;for,&nbsp;increment.</span></div></li>
<li><div class="src-line"><a name="a937"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;++<span class="src-var">$i</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a938"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a939"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a940"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;We&nbsp;don't&nbsp;care&nbsp;about&nbsp;type.&nbsp;Any&nbsp;tagName&nbsp;will&nbsp;match.</span></div></li>
<li><div class="src-line"><a name="a941"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">else&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a942"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$i&nbsp;</span>==&nbsp;<span class="src-var">$index</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a943"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-var">$child</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a944"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a945"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a946"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;++<span class="src-var">$i</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a947"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a948"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}&nbsp;</span><span class="src-comm">//&nbsp;End&nbsp;foreach</span></div></li>
<li><div class="src-line"><a name="a949"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a950"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a951"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a952"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a953"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a954"></a>&nbsp;&nbsp;<span class="src-key">protected&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodnthOfTypeChild">nthOfTypeChild</a><span class="src-sym">(</span><span class="src-var">$groupSize</span><span class="src-sym">,&nbsp;</span><span class="src-var">$elementInGroup</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a955"></a>&nbsp;&nbsp;&nbsp;&nbsp;throw&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id">Exception</span><span class="src-sym">(</span><span class="src-str">&quot;Not&nbsp;implemented&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a956"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a957"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a958"></a>&nbsp;&nbsp;<span class="src-key">protected&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodnthLastOfTypeChild">nthLastOfTypeChild</a><span class="src-sym">(</span><span class="src-var">$groupSize</span><span class="src-sym">,&nbsp;</span><span class="src-var">$elementInGroup</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a959"></a>&nbsp;&nbsp;&nbsp;&nbsp;throw&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id">Exception</span><span class="src-sym">(</span><span class="src-str">&quot;Not&nbsp;implemented&quot;</span><span class="src-sym">)</span><span class="src-sym">;&nbsp;&nbsp;&nbsp;&nbsp;</span></div></li>
<li><div class="src-line"><a name="a960"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a961"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a962"></a>&nbsp;&nbsp;<span class="src-key">protected&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodlang">lang</a><span class="src-sym">(</span><span class="src-var">$value</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a963"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;TODO:&nbsp;This&nbsp;checks&nbsp;for&nbsp;cases&nbsp;where&nbsp;an&nbsp;explicit&nbsp;language&nbsp;is</span></div></li>
<li><div class="src-line"><a name="a964"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;set.&nbsp;The&nbsp;spec&nbsp;seems&nbsp;to&nbsp;indicate&nbsp;that&nbsp;an&nbsp;element&nbsp;should&nbsp;inherit</span></div></li>
<li><div class="src-line"><a name="a965"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;language&nbsp;from&nbsp;the&nbsp;parent...&nbsp;but&nbsp;this&nbsp;is&nbsp;unclear.</span></div></li>
<li><div class="src-line"><a name="a966"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$operator&nbsp;</span>=&nbsp;<span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$value</span><span class="src-sym">,&nbsp;</span><span class="src-str">'-'</span><span class="src-sym">)&nbsp;</span>!==&nbsp;<span class="src-id">FALSE</span><span class="src-sym">)&nbsp;</span>?&nbsp;<span class="src-id">self</span><span class="src-sym">::</span><span class="src-id">isExactly&nbsp;</span>:&nbsp;<span class="src-id">self</span><span class="src-sym">::</span><span class="src-id">containsWithHyphen</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a967"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a968"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$orig&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a969"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$origDepth&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$findAnyElement">findAnyElement</a><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a970"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a971"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Do&nbsp;first&nbsp;pass</span></div></li>
<li><div class="src-line"><a name="a972"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodattribute">attribute</a><span class="src-sym">(</span><span class="src-str">'lang'</span><span class="src-sym">,&nbsp;</span><span class="src-var">$value</span><span class="src-sym">,&nbsp;</span><span class="src-var">$operator</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a973"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$lang&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a><span class="src-sym">;&nbsp;</span><span class="src-comm">//&nbsp;Temp&nbsp;array&nbsp;for&nbsp;merging.</span></div></li>
<li><div class="src-line"><a name="a974"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a975"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Reset</span></div></li>
<li><div class="src-line"><a name="a976"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-var">$orig</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a977"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$findAnyElement">findAnyElement</a>&nbsp;=&nbsp;<span class="src-var">$origDepth</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a978"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a979"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Do&nbsp;second&nbsp;pass</span></div></li>
<li><div class="src-line"><a name="a980"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodattributeNS">attributeNS</a><span class="src-sym">(</span><span class="src-str">'lang'</span><span class="src-sym">,&nbsp;</span><span class="src-str">'xml'</span><span class="src-sym">,&nbsp;</span><span class="src-var">$value</span><span class="src-sym">,&nbsp;</span><span class="src-var">$operator</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a981"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a982"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Merge&nbsp;results</span></div></li>
<li><div class="src-line"><a name="a983"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<a href="http://www.php.net/array_merge">array_merge</a><span class="src-sym">(</span><span class="src-var">$lang</span><span class="src-sym">,&nbsp;</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a984"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a985"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a986"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a987"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;Pseudo-class&nbsp;handler&nbsp;for&nbsp;:not(filter).</span></div></li>
<li><div class="src-line"><a name="a988"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a989"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;This&nbsp;does&nbsp;not&nbsp;follow&nbsp;the&nbsp;specification&nbsp;in&nbsp;the&nbsp;following&nbsp;way:&nbsp;The&nbsp;CSS&nbsp;3</span></div></li>
<li><div class="src-line"><a name="a990"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;selector&nbsp;spec&nbsp;says&nbsp;the&nbsp;value&nbsp;of&nbsp;not()&nbsp;must&nbsp;be&nbsp;a&nbsp;simple&nbsp;selector.&nbsp;This</span></div></li>
<li><div class="src-line"><a name="a991"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;function&nbsp;allows&nbsp;complex&nbsp;selectors.</span></div></li>
<li><div class="src-line"><a name="a992"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a993"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc-type">string&nbsp;</span><span class="src-doc-var">$filter&nbsp;</span></div></li>
<li><div class="src-line"><a name="a994"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;A&nbsp;CSS&nbsp;selector.</span></div></li>
<li><div class="src-line"><a name="a995"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a996"></a>&nbsp;&nbsp;<span class="src-key">protected&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodnot">not</a><span class="src-sym">(</span><span class="src-var">$filter</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a997"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$matches&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-id">candidateList</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a998"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a999"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$matches&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$item</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1000"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$handler&nbsp;</span>=&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id"><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html">QueryPathCssEventHandler</a></span><span class="src-sym">(</span><span class="src-var">$item</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1001"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$not_these&nbsp;</span>=&nbsp;<span class="src-var">$handler</span><span class="src-sym">-&gt;</span><span class="src-id">find</span><span class="src-sym">(</span><span class="src-var">$filter</span><span class="src-sym">)</span><span class="src-sym">-&gt;</span><span class="src-id">getMatches</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1002"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><a href="http://www.php.net/count">count</a><span class="src-sym">(</span><span class="src-var">$not_these</span><span class="src-sym">)&nbsp;</span>==&nbsp;<span class="src-num">0</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1003"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$item</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1004"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1005"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1006"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;No&nbsp;need&nbsp;to&nbsp;check&nbsp;for&nbsp;unique&nbsp;elements,&nbsp;since&nbsp;the&nbsp;list</span></div></li>
<li><div class="src-line"><a name="a1007"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;we&nbsp;began&nbsp;from&nbsp;already&nbsp;had&nbsp;no&nbsp;duplicates.</span></div></li>
<li><div class="src-line"><a name="a1008"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-var">$found</span><span class="src-sym">;&nbsp;&nbsp;&nbsp;&nbsp;</span></div></li>
<li><div class="src-line"><a name="a1009"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1010"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a1011"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a1012"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;Pseudo-class&nbsp;handler&nbsp;for&nbsp;:has(filter).</span></div></li>
<li><div class="src-line"><a name="a1013"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;This&nbsp;can&nbsp;also&nbsp;be&nbsp;used&nbsp;as&nbsp;a&nbsp;general&nbsp;filtering&nbsp;routine.</span></div></li>
<li><div class="src-line"><a name="a1014"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a1015"></a>&nbsp;&nbsp;<span class="src-key">public&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodhas">has</a><span class="src-sym">(</span><span class="src-var">$filter</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1016"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$matches&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-id">candidateList</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1017"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1018"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$matches&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$item</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1019"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$handler&nbsp;</span>=&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id"><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html">QueryPathCssEventHandler</a></span><span class="src-sym">(</span><span class="src-var">$item</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1020"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$these&nbsp;</span>=&nbsp;<span class="src-var">$handler</span><span class="src-sym">-&gt;</span><span class="src-id">find</span><span class="src-sym">(</span><span class="src-var">$filter</span><span class="src-sym">)</span><span class="src-sym">-&gt;</span><span class="src-id">getMatches</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1021"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><a href="http://www.php.net/count">count</a><span class="src-sym">(</span><span class="src-var">$these</span><span class="src-sym">)&nbsp;</span>&gt;&nbsp;<span class="src-num">0</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1022"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$item</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1023"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></div></li>
<li><div class="src-line"><a name="a1024"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1025"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-id"><a href="../QueryPath/CSSParser/UniqueElementList.html">UniqueElementList</a></span><span class="src-sym">::</span><a href="../QueryPath/CSSParser/UniqueElementList.html#methodget">get</a><span class="src-sym">(</span><span class="src-var">$found</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1026"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$this</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1027"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1028"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a1029"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a1030"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;Pseudo-class&nbsp;handler&nbsp;for&nbsp;:first-of-type.</span></div></li>
<li><div class="src-line"><a name="a1031"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a1032"></a>&nbsp;&nbsp;<span class="src-key">protected&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodfirstOfType">firstOfType</a><span class="src-sym">(</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1033"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$matches&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-id">candidateList</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1034"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1035"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$matches&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$item</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1036"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$type&nbsp;</span>=&nbsp;<span class="src-var">$item</span><span class="src-sym">-&gt;</span><span class="src-id">tagName</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1037"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$parent&nbsp;</span>=&nbsp;<span class="src-var">$item</span><span class="src-sym">-&gt;</span><span class="src-id">parentNode</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1038"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$parent</span><span class="src-sym">-&gt;</span><span class="src-id">childNodes&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$kid</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1039"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$kid</span><span class="src-sym">-&gt;</span><span class="src-id">nodeType&nbsp;</span>==&nbsp;<span class="src-id">XML_ELEMENT_NODE&nbsp;</span>&amp;&amp;&nbsp;<span class="src-var">$kid</span><span class="src-sym">-&gt;</span><span class="src-id">tagName&nbsp;</span>==&nbsp;<span class="src-var">$type</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1040"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/in_array">in_array</a><span class="src-sym">(</span><span class="src-var">$kid</span><span class="src-sym">,&nbsp;</span><span class="src-var">$found</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1041"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$kid</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1042"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1043"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1044"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1045"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1046"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1047"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-var">$found</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1048"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1049"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a1050"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a1051"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;Pseudo-class&nbsp;handler&nbsp;for&nbsp;:last-of-type.</span></div></li>
<li><div class="src-line"><a name="a1052"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a1053"></a>&nbsp;&nbsp;<span class="src-key">protected&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodlastOfType">lastOfType</a><span class="src-sym">(</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1054"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$matches&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-id">candidateList</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1055"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1056"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$matches&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$item</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1057"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$type&nbsp;</span>=&nbsp;<span class="src-var">$item</span><span class="src-sym">-&gt;</span><span class="src-id">tagName</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1058"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$parent&nbsp;</span>=&nbsp;<span class="src-var">$item</span><span class="src-sym">-&gt;</span><span class="src-id">parentNode</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1059"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">for&nbsp;</span><span class="src-sym">(</span><span class="src-var">$i&nbsp;</span>=&nbsp;<span class="src-var">$parent</span><span class="src-sym">-&gt;</span><span class="src-id">childNodes</span><span class="src-sym">-&gt;</span><span class="src-id">length&nbsp;</span>-&nbsp;<span class="src-num">1</span><span class="src-sym">;&nbsp;</span><span class="src-var">$i&nbsp;</span>&gt;=&nbsp;<span class="src-num">0</span><span class="src-sym">;&nbsp;</span>--<span class="src-var">$i</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1060"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$kid&nbsp;</span>=&nbsp;<span class="src-var">$parent</span><span class="src-sym">-&gt;</span><span class="src-id">childNodes</span><span class="src-sym">-&gt;</span><span class="src-id">item</span><span class="src-sym">(</span><span class="src-var">$i</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1061"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$kid</span><span class="src-sym">-&gt;</span><span class="src-id">nodeType&nbsp;</span>==&nbsp;<span class="src-id">XML_ELEMENT_NODE&nbsp;</span>&amp;&amp;&nbsp;<span class="src-var">$kid</span><span class="src-sym">-&gt;</span><span class="src-id">tagName&nbsp;</span>==&nbsp;<span class="src-var">$type</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1062"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/in_array">in_array</a><span class="src-sym">(</span><span class="src-var">$kid</span><span class="src-sym">,&nbsp;</span><span class="src-var">$found</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1063"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$kid</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1064"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1065"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1066"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1067"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1068"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1069"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-var">$found</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1070"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1071"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a1072"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a1073"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;Pseudo-class&nbsp;handler&nbsp;for&nbsp;:only-child.</span></div></li>
<li><div class="src-line"><a name="a1074"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a1075"></a>&nbsp;&nbsp;<span class="src-key">protected&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodonlyChild">onlyChild</a><span class="src-sym">(</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1076"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$matches&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-id">candidateList</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1077"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1078"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach</span><span class="src-sym">(</span><span class="src-var">$matches&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$item</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1079"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$parent&nbsp;</span>=&nbsp;<span class="src-var">$item</span><span class="src-sym">-&gt;</span><span class="src-id">parentNode</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1080"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$kids&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1081"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach</span><span class="src-sym">(</span><span class="src-var">$parent</span><span class="src-sym">-&gt;</span><span class="src-id">childNodes&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$kid</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1082"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$kid</span><span class="src-sym">-&gt;</span><span class="src-id">nodeType&nbsp;</span>==&nbsp;<span class="src-id">XML_ELEMENT_NODE</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1083"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$kids</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$kid</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1084"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1085"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1086"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;There&nbsp;should&nbsp;be&nbsp;only&nbsp;one&nbsp;child&nbsp;element,&nbsp;and</span></div></li>
<li><div class="src-line"><a name="a1087"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;it&nbsp;should&nbsp;be&nbsp;the&nbsp;one&nbsp;being&nbsp;tested.</span></div></li>
<li><div class="src-line"><a name="a1088"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><a href="http://www.php.net/count">count</a><span class="src-sym">(</span><span class="src-var">$kids</span><span class="src-sym">)&nbsp;</span>==&nbsp;<span class="src-num">1&nbsp;</span>&amp;&amp;&nbsp;<span class="src-var">$kids</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]&nbsp;</span>===&nbsp;<span class="src-var">$item</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1089"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$kids</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1090"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1091"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1092"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-id"><a href="../QueryPath/CSSParser/UniqueElementList.html">UniqueElementList</a></span><span class="src-sym">::</span><a href="../QueryPath/CSSParser/UniqueElementList.html#methodget">get</a><span class="src-sym">(</span><span class="src-var">$found</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1093"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1094"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a1095"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a1096"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;Pseudo-class&nbsp;handler&nbsp;for&nbsp;:empty.</span></div></li>
<li><div class="src-line"><a name="a1097"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a1098"></a>&nbsp;&nbsp;<span class="src-key">protected&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodemptyElement">emptyElement</a><span class="src-sym">(</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1099"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1100"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$matches&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-id">candidateList</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1101"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$matches&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$item</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1102"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$empty&nbsp;</span>=&nbsp;<span class="src-id">TRUE</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1103"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach</span><span class="src-sym">(</span><span class="src-var">$item</span><span class="src-sym">-&gt;</span><span class="src-id">childNodes&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$kid</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1104"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;From&nbsp;the&nbsp;spec:&nbsp;Elements&nbsp;and&nbsp;Text&nbsp;nodes&nbsp;are&nbsp;the&nbsp;only&nbsp;ones&nbsp;to</span></div></li>
<li><div class="src-line"><a name="a1105"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;affect&nbsp;emptiness.</span></div></li>
<li><div class="src-line"><a name="a1106"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$kid</span><span class="src-sym">-&gt;</span><span class="src-id">nodeType&nbsp;</span>==&nbsp;<span class="src-id">XML_ELEMENT_NODE&nbsp;</span>||&nbsp;<span class="src-var">$kid</span><span class="src-sym">-&gt;</span><span class="src-id">nodType&nbsp;</span>==&nbsp;<span class="src-id">XML_TEXT_NODE</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1107"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$empty&nbsp;</span>=&nbsp;<span class="src-id">FALSE</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1108"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1109"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1110"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1111"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$empty</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1112"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$item</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1113"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1114"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1115"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-var">$found</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1116"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1117"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a1118"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a1119"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;Pseudo-class&nbsp;handler&nbsp;for&nbsp;:only-of-type.</span></div></li>
<li><div class="src-line"><a name="a1120"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a1121"></a>&nbsp;&nbsp;<span class="src-key">protected&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodonlyOfType">onlyOfType</a><span class="src-sym">(</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1122"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$matches&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-id">candidateList</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1123"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1124"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$matches&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$item</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1125"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$item</span><span class="src-sym">-&gt;</span><span class="src-id">parentNode</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1126"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1127"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1128"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$parent&nbsp;</span>=&nbsp;<span class="src-var">$item</span><span class="src-sym">-&gt;</span><span class="src-id">parentNode</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1129"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach</span><span class="src-sym">(</span><span class="src-var">$parent</span><span class="src-sym">-&gt;</span><span class="src-id">childNodes&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$kid</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1130"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$kid</span><span class="src-sym">-&gt;</span><span class="src-id">nodeType&nbsp;</span>==&nbsp;<span class="src-id">XML_ELEMENT_NODE&nbsp;</span>&amp;&amp;&nbsp;<span class="src-var">$kid</span><span class="src-sym">-&gt;</span><span class="src-id">tagName&nbsp;</span>==&nbsp;<span class="src-var">$item</span><span class="src-sym">-&gt;</span><span class="src-id">tagName&nbsp;</span>&amp;&amp;&nbsp;<span class="src-var">$kid&nbsp;</span>!==&nbsp;<span class="src-var">$item</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1131"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1132"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1133"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1134"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1135"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$item</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1136"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1137"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-var">$found</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1138"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1139"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a1140"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a1141"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;Check&nbsp;for&nbsp;attr&nbsp;value&nbsp;matches&nbsp;based&nbsp;on&nbsp;an&nbsp;operation.</span></div></li>
<li><div class="src-line"><a name="a1142"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a1143"></a>&nbsp;&nbsp;<span class="src-key">protected&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodattrValMatches">attrValMatches</a><span class="src-sym">(</span><span class="src-var">$needle</span><span class="src-sym">,&nbsp;</span><span class="src-var">$haystack</span><span class="src-sym">,&nbsp;</span><span class="src-var">$operation</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1144"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a1145"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><a href="http://www.php.net/strlen">strlen</a><span class="src-sym">(</span><span class="src-var">$haystack</span><span class="src-sym">)&nbsp;</span>&lt;&nbsp;<a href="http://www.php.net/strlen">strlen</a><span class="src-sym">(</span><span class="src-var">$needle</span><span class="src-sym">))&nbsp;</span><span class="src-key">return&nbsp;</span><span class="src-id">FALSE</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1146"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a1147"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;According&nbsp;to&nbsp;the&nbsp;spec:&nbsp;&nbsp;</span></div></li>
<li><div class="src-line"><a name="a1148"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;&quot;The&nbsp;case-sensitivity&nbsp;of&nbsp;attribute&nbsp;names&nbsp;in&nbsp;selectors&nbsp;depends&nbsp;on&nbsp;the&nbsp;document&nbsp;language.&quot;</span></div></li>
<li><div class="src-line"><a name="a1149"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;(6.3.2)</span></div></li>
<li><div class="src-line"><a name="a1150"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;To&nbsp;which&nbsp;I&nbsp;say,&nbsp;&quot;huh?&quot;.&nbsp;We&nbsp;assume&nbsp;case&nbsp;sensitivity.</span></div></li>
<li><div class="src-line"><a name="a1151"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">switch&nbsp;</span><span class="src-sym">(</span><span class="src-var">$operation</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1152"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-id"><a href="../QueryPath/CSSParser/CssEventHandler.html">CssEventHandler</a></span><span class="src-sym">::</span><span class="src-id">isExactly</span>:</div></li>
<li><div class="src-line"><a name="a1153"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$needle&nbsp;</span>==&nbsp;<span class="src-var">$haystack</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1154"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-id"><a href="../QueryPath/CSSParser/CssEventHandler.html">CssEventHandler</a></span><span class="src-sym">::</span><span class="src-id">containsWithSpace</span>:</div></li>
<li><div class="src-line"><a name="a1155"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><a href="http://www.php.net/in_array">in_array</a><span class="src-sym">(</span><span class="src-var">$needle</span><span class="src-sym">,&nbsp;</span><a href="http://www.php.net/explode">explode</a><span class="src-sym">(</span><span class="src-str">'&nbsp;'</span><span class="src-sym">,&nbsp;</span><span class="src-var">$haystack</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1156"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-id"><a href="../QueryPath/CSSParser/CssEventHandler.html">CssEventHandler</a></span><span class="src-sym">::</span><span class="src-id">containsWithHyphen</span>:</div></li>
<li><div class="src-line"><a name="a1157"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><a href="http://www.php.net/in_array">in_array</a><span class="src-sym">(</span><span class="src-var">$needle</span><span class="src-sym">,&nbsp;</span><a href="http://www.php.net/explode">explode</a><span class="src-sym">(</span><span class="src-str">'-'</span><span class="src-sym">,&nbsp;</span><span class="src-var">$haystack</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1158"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-id"><a href="../QueryPath/CSSParser/CssEventHandler.html">CssEventHandler</a></span><span class="src-sym">::</span><span class="src-id">containsInString</span>:</div></li>
<li><div class="src-line"><a name="a1159"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$haystack</span><span class="src-sym">,&nbsp;</span><span class="src-var">$needle</span><span class="src-sym">)&nbsp;</span>!==&nbsp;<span class="src-id">FALSE</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1160"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-id"><a href="../QueryPath/CSSParser/CssEventHandler.html">CssEventHandler</a></span><span class="src-sym">::</span><span class="src-id">beginsWith</span>:</div></li>
<li><div class="src-line"><a name="a1161"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$haystack</span><span class="src-sym">,&nbsp;</span><span class="src-var">$needle</span><span class="src-sym">)&nbsp;</span>===&nbsp;<span class="src-num">0</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1162"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-id"><a href="../QueryPath/CSSParser/CssEventHandler.html">CssEventHandler</a></span><span class="src-sym">::</span><span class="src-id">endsWith</span>:</div></li>
<li><div class="src-line"><a name="a1163"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//return&nbsp;strrpos($haystack,&nbsp;$needle)&nbsp;===&nbsp;strlen($needle)&nbsp;-&nbsp;1;</span></div></li>
<li><div class="src-line"><a name="a1164"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><a href="http://www.php.net/preg_match">preg_match</a><span class="src-sym">(</span><span class="src-str">'/'&nbsp;</span>.&nbsp;<span class="src-var">$needle&nbsp;</span>.&nbsp;<span class="src-str">'$/'</span><span class="src-sym">,&nbsp;</span><span class="src-var">$haystack</span><span class="src-sym">)&nbsp;</span>==&nbsp;<span class="src-num">1</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1165"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1166"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-id">FALSE</span><span class="src-sym">;&nbsp;</span><span class="src-comm">//&nbsp;Shouldn't&nbsp;be&nbsp;able&nbsp;to&nbsp;get&nbsp;here.</span></div></li>
<li><div class="src-line"><a name="a1167"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1168"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a1169"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a1170"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;As&nbsp;the&nbsp;spec&nbsp;mentions,&nbsp;these&nbsp;must&nbsp;be&nbsp;at&nbsp;the&nbsp;end&nbsp;of&nbsp;a&nbsp;selector&nbsp;or</span></div></li>
<li><div class="src-line"><a name="a1171"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;else&nbsp;they&nbsp;will&nbsp;cause&nbsp;errors.&nbsp;Most&nbsp;selectors&nbsp;return&nbsp;elements.&nbsp;Pseudo-elements</span></div></li>
<li><div class="src-line"><a name="a1172"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;do&nbsp;not.</span></div></li>
<li><div class="src-line"><a name="a1173"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a1174"></a>&nbsp;&nbsp;<span class="src-key">public&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodpseudoElement">pseudoElement</a><span class="src-sym">(</span><span class="src-var">$name</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1175"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;process&nbsp;the&nbsp;pseudoElement</span></div></li>
<li><div class="src-line"><a name="a1176"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">switch&nbsp;</span><span class="src-sym">(</span><span class="src-var">$name</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1177"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'first-line'</span>:</div></li>
<li><div class="src-line"><a name="a1178"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$matches&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-id">candidateList</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1179"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1180"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$matches&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$item</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1181"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$str&nbsp;</span>=&nbsp;<span class="src-var">$item</span><span class="src-sym">-&gt;</span><span class="src-id">textContent</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1182"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$lines&nbsp;</span>=&nbsp;<a href="http://www.php.net/explode">explode</a><span class="src-sym">(</span><span class="src-str">&quot;\n&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-var">$str</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1183"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$lines</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1184"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$line&nbsp;</span>=&nbsp;<a href="http://www.php.net/trim">trim</a><span class="src-sym">(</span><span class="src-var">$lines</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1185"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$line</span><span class="src-sym">))</span></div></li>
<li><div class="src-line"><a name="a1186"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$line</span><span class="src-sym">;</span><span class="src-comm">//trim($lines[0]);</span></div></li>
<li><div class="src-line"><a name="a1187"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1188"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1189"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-var">$found</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1190"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1191"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'first-letter'</span>:</div></li>
<li><div class="src-line"><a name="a1192"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$matches&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-id">candidateList</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1193"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1194"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$matches&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$item</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1195"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$str&nbsp;</span>=&nbsp;<span class="src-var">$item</span><span class="src-sym">-&gt;</span><span class="src-id">textContent</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1196"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$str</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1197"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-var">$str</span><span class="src-sym">,</span><span class="src-num">0</span><span class="src-sym">,&nbsp;</span><span class="src-num">1</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1198"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1199"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1200"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-var">$found</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1201"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1202"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'before'</span>:</div></li>
<li><div class="src-line"><a name="a1203"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'after'</span>:</div></li>
<li><div class="src-line"><a name="a1204"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;There&nbsp;is&nbsp;nothing&nbsp;in&nbsp;a&nbsp;DOM&nbsp;to&nbsp;return&nbsp;for&nbsp;the&nbsp;before&nbsp;and&nbsp;after&nbsp;</span></div></li>
<li><div class="src-line"><a name="a1205"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;selectors.</span></div></li>
<li><div class="src-line"><a name="a1206"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'selection'</span>:</div></li>
<li><div class="src-line"><a name="a1207"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;With&nbsp;no&nbsp;user&nbsp;agent,&nbsp;we&nbsp;don't&nbsp;have&nbsp;a&nbsp;concept&nbsp;of&nbsp;user&nbsp;selection.</span></div></li>
<li><div class="src-line"><a name="a1208"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id"><a href="../QueryPath/CSSParser/NotImplementedException.html">NotImplementedException</a></span><span class="src-sym">(</span><span class="src-str">&quot;</span><span class="src-str">The&nbsp;<span class="src-var">$name</span>&nbsp;pseudo-element&nbsp;is&nbsp;not&nbsp;implemented.</span><span class="src-str">&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1209"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1210"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1211"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$findAnyElement">findAnyElement</a>&nbsp;=&nbsp;<span class="src-id">FALSE</span><span class="src-sym">;&nbsp;&nbsp;</span></div></li>
<li><div class="src-line"><a name="a1212"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1213"></a>&nbsp;&nbsp;<span class="src-key">public&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methoddirectDescendant">directDescendant</a><span class="src-sym">(</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1214"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$findAnyElement">findAnyElement</a>&nbsp;=&nbsp;<span class="src-id">FALSE</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1215"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a1216"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$kids&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1217"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;<span class="src-key">as&nbsp;</span><span class="src-var">$item</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1218"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$kidsNL&nbsp;</span>=&nbsp;<span class="src-var">$item</span><span class="src-sym">-&gt;</span><span class="src-id">childNodes</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1219"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$kidsNL&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$kidNode</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1220"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$kidNode</span><span class="src-sym">-&gt;</span><span class="src-id">nodeType&nbsp;</span>==&nbsp;<span class="src-id">XML_ELEMENT_NODE</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1221"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$kids</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$kidNode</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1222"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1223"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1224"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1225"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-id"><a href="../QueryPath/CSSParser/UniqueElementList.html">UniqueElementList</a></span><span class="src-sym">::</span><a href="../QueryPath/CSSParser/UniqueElementList.html#methodget">get</a><span class="src-sym">(</span><span class="src-var">$kids</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1226"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1227"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a1228"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;For&nbsp;an&nbsp;element&nbsp;to&nbsp;be&nbsp;adjacent&nbsp;to&nbsp;another,&nbsp;it&nbsp;must&nbsp;be&nbsp;THE&nbsp;NEXT&nbsp;NODE</span></div></li>
<li><div class="src-line"><a name="a1229"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;in&nbsp;the&nbsp;node&nbsp;list.&nbsp;So&nbsp;if&nbsp;an&nbsp;element&nbsp;is&nbsp;surrounded&nbsp;by&nbsp;pcdata,&nbsp;there&nbsp;are</span></div></li>
<li><div class="src-line"><a name="a1230"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;no&nbsp;adjacent&nbsp;nodes.&nbsp;E.g.&nbsp;in&nbsp;&lt;a/&gt;FOO&lt;b/&gt;,&nbsp;the&nbsp;a&nbsp;and&nbsp;b&nbsp;elements&nbsp;are&nbsp;not</span></div></li>
<li><div class="src-line"><a name="a1231"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;adjacent.</span></div></li>
<li><div class="src-line"><a name="a1232"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a1233"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;In&nbsp;a&nbsp;strict&nbsp;DOM&nbsp;parser,&nbsp;line&nbsp;breaks&nbsp;and&nbsp;empty&nbsp;spaces&nbsp;are&nbsp;nodes.&nbsp;That&nbsp;means</span></div></li>
<li><div class="src-line"><a name="a1234"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;nodes&nbsp;like&nbsp;this&nbsp;will&nbsp;not&nbsp;be&nbsp;adjacent:&nbsp;&lt;test/&gt;&nbsp;&lt;test/&gt;.&nbsp;The&nbsp;space&nbsp;between</span></div></li>
<li><div class="src-line"><a name="a1235"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;them&nbsp;makes&nbsp;them&nbsp;non-adjacent.&nbsp;If&nbsp;this&nbsp;is&nbsp;not&nbsp;the&nbsp;desired&nbsp;behavior,&nbsp;pass</span></div></li>
<li><div class="src-line"><a name="a1236"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;in&nbsp;the&nbsp;appropriate&nbsp;flags&nbsp;to&nbsp;your&nbsp;parser.&nbsp;Example:</span></div></li>
<li><div class="src-line"><a name="a1237"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;&lt;code&gt;</span></div></li>
<li><div class="src-line"><a name="a1238"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;$doc&nbsp;=&nbsp;new&nbsp;DomDocument();</span></div></li>
<li><div class="src-line"><a name="a1239"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;$doc-&gt;loadXML('&lt;test/&gt;&nbsp;&lt;test/&gt;',&nbsp;LIBXML_NOBLANKS);</span></div></li>
<li><div class="src-line"><a name="a1240"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;&lt;/code&gt;</span></div></li>
<li><div class="src-line"><a name="a1241"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a1242"></a>&nbsp;&nbsp;<span class="src-key">public&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodadjacent">adjacent</a><span class="src-sym">(</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1243"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$findAnyElement">findAnyElement</a>&nbsp;=&nbsp;<span class="src-id">FALSE</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1244"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;List&nbsp;of&nbsp;nodes&nbsp;that&nbsp;are&nbsp;immediately&nbsp;adjacent&nbsp;to&nbsp;the&nbsp;current&nbsp;one.</span></div></li>
<li><div class="src-line"><a name="a1245"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1246"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;<span class="src-key">as&nbsp;</span><span class="src-var">$item</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1247"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-var">$item</span><span class="src-sym">-&gt;</span><span class="src-id">nextSibling</span><span class="src-sym">)&nbsp;</span>&amp;&amp;&nbsp;<span class="src-var">$item</span><span class="src-sym">-&gt;</span><span class="src-id">nextSibling</span><span class="src-sym">-&gt;</span><span class="src-id">nodeType&nbsp;</span>===&nbsp;<span class="src-id">XML_ELEMENT_NODE</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1248"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$item</span><span class="src-sym">-&gt;</span><span class="src-id">nextSibling</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1249"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1250"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1251"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-id"><a href="../QueryPath/CSSParser/UniqueElementList.html">UniqueElementList</a></span><span class="src-sym">::</span><a href="../QueryPath/CSSParser/UniqueElementList.html#methodget">get</a><span class="src-sym">(</span><span class="src-var">$found</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1252"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1253"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a1254"></a>&nbsp;&nbsp;<span class="src-key">public&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodanotherSelector">anotherSelector</a><span class="src-sym">(</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1255"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$findAnyElement">findAnyElement</a>&nbsp;=&nbsp;<span class="src-id">FALSE</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1256"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Copy&nbsp;old&nbsp;matches&nbsp;into&nbsp;buffer.</span></div></li>
<li><div class="src-line"><a name="a1257"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1258"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//$this-&gt;alreadyMatched[]&nbsp;=&nbsp;$this-&gt;matches;</span></div></li>
<li><div class="src-line"><a name="a1259"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$alreadyMatched">alreadyMatched</a>&nbsp;=&nbsp;<a href="http://www.php.net/array_merge">array_merge</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$alreadyMatched">alreadyMatched</a><span class="src-sym">,&nbsp;</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1260"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1261"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a1262"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Start&nbsp;over&nbsp;at&nbsp;the&nbsp;top&nbsp;of&nbsp;the&nbsp;tree.</span></div></li>
<li><div class="src-line"><a name="a1263"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$findAnyElement">findAnyElement</a>&nbsp;=&nbsp;<span class="src-id">TRUE</span><span class="src-sym">;&nbsp;</span><span class="src-comm">//&nbsp;Reset&nbsp;depth&nbsp;flag.</span></div></li>
<li><div class="src-line"><a name="a1264"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$dom">dom</a><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1265"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1266"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a1267"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a1268"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;Get&nbsp;all&nbsp;nodes&nbsp;that&nbsp;are&nbsp;siblings&nbsp;to&nbsp;currently&nbsp;selected&nbsp;nodes.</span></div></li>
<li><div class="src-line"><a name="a1269"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a1270"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;If&nbsp;two&nbsp;passed&nbsp;in&nbsp;items&nbsp;are&nbsp;siblings&nbsp;of&nbsp;each&nbsp;other,&nbsp;neither&nbsp;will</span></div></li>
<li><div class="src-line"><a name="a1271"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;be&nbsp;included&nbsp;in&nbsp;the&nbsp;list&nbsp;of&nbsp;siblings.&nbsp;Their&nbsp;status&nbsp;as&nbsp;being&nbsp;candidates</span></div></li>
<li><div class="src-line"><a name="a1272"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;excludes&nbsp;them&nbsp;from&nbsp;being&nbsp;considered&nbsp;siblings.</span></div></li>
<li><div class="src-line"><a name="a1273"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a1274"></a>&nbsp;&nbsp;<span class="src-key">public&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodsibling">sibling</a><span class="src-sym">(</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1275"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$findAnyElement">findAnyElement</a>&nbsp;=&nbsp;<span class="src-id">FALSE</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1276"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Get&nbsp;the&nbsp;nodes&nbsp;at&nbsp;the&nbsp;same&nbsp;level.</span></div></li>
<li><div class="src-line"><a name="a1277"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a1278"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1279"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$sibs&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1280"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;<span class="src-key">as&nbsp;</span><span class="src-var">$item</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1281"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$candidates&nbsp;</span>=&nbsp;<span class="src-var">$item</span><span class="src-sym">-&gt;</span><span class="src-id">parentNode</span><span class="src-sym">-&gt;</span><span class="src-id">childNodes</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1282"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$candidates&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$candidate</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1283"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$candidate</span><span class="src-sym">-&gt;</span><span class="src-id">nodeType&nbsp;</span>===&nbsp;<span class="src-id">XML_ELEMENT_NODE&nbsp;</span>&amp;&amp;&nbsp;<span class="src-var">$candidate&nbsp;</span>!==&nbsp;<span class="src-var">$item</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1284"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$sibs</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$candidate</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1285"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1286"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1287"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1288"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Do&nbsp;we&nbsp;need&nbsp;to&nbsp;remove&nbsp;duplicates&nbsp;for&nbsp;any&nbsp;reason?</span></div></li>
<li><div class="src-line"><a name="a1289"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-id"><a href="../QueryPath/CSSParser/UniqueElementList.html">UniqueElementList</a></span><span class="src-sym">::</span><a href="../QueryPath/CSSParser/UniqueElementList.html#methodget">get</a><span class="src-sym">(</span><span class="src-var">$sibs</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1290"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1291"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1292"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a1293"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a1294"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;Get&nbsp;any&nbsp;descendant.</span></div></li>
<li><div class="src-line"><a name="a1295"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a1296"></a>&nbsp;&nbsp;<span class="src-key">public&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodanyDescendant">anyDescendant</a><span class="src-sym">(</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1297"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Get&nbsp;children:</span></div></li>
<li><div class="src-line"><a name="a1298"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1299"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;<span class="src-key">as&nbsp;</span><span class="src-var">$item</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1300"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$kids&nbsp;</span>=&nbsp;<span class="src-var">$item</span><span class="src-sym">-&gt;</span><span class="src-id">getElementsByTagName</span><span class="src-sym">(</span><span class="src-str">'*'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1301"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found&nbsp;</span>=&nbsp;<a href="http://www.php.net/array_merge">array_merge</a><span class="src-sym">(</span><span class="src-var">$found</span><span class="src-sym">,&nbsp;</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodnodeListToArray">nodeListToArray</a><span class="src-sym">(</span><span class="src-var">$kids</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1302"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1303"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a>&nbsp;=&nbsp;<span class="src-id"><a href="../QueryPath/CSSParser/UniqueElementList.html">UniqueElementList</a></span><span class="src-sym">::</span><a href="../QueryPath/CSSParser/UniqueElementList.html#methodget">get</a><span class="src-sym">(</span><span class="src-var">$found</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1304"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a1305"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Set&nbsp;depth&nbsp;flag:</span></div></li>
<li><div class="src-line"><a name="a1306"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$findAnyElement">findAnyElement</a>&nbsp;=&nbsp;<span class="src-id">TRUE</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1307"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1308"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a1309"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a1310"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;Determine&nbsp;what&nbsp;candidates&nbsp;are&nbsp;in&nbsp;the&nbsp;current&nbsp;scope.</span></div></li>
<li><div class="src-line"><a name="a1311"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a1312"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;This&nbsp;is&nbsp;a&nbsp;utility&nbsp;method&nbsp;that&nbsp;gets&nbsp;the&nbsp;list&nbsp;of&nbsp;elements</span></div></li>
<li><div class="src-line"><a name="a1313"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;that&nbsp;should&nbsp;be&nbsp;evaluated&nbsp;in&nbsp;the&nbsp;context.&nbsp;If&nbsp;$this-&gt;findAnyElement</span></div></li>
<li><div class="src-line"><a name="a1314"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;is&nbsp;TRUE,&nbsp;this&nbsp;will&nbsp;return&nbsp;a&nbsp;list&nbsp;of&nbsp;every&nbsp;element&nbsp;that&nbsp;appears&nbsp;in</span></div></li>
<li><div class="src-line"><a name="a1315"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;the&nbsp;subtree&nbsp;of&nbsp;$this-&gt;matches.&nbsp;Otherwise,&nbsp;it&nbsp;will&nbsp;just&nbsp;return</span></div></li>
<li><div class="src-line"><a name="a1316"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;$this-&gt;matches.</span></div></li>
<li><div class="src-line"><a name="a1317"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a1318"></a>&nbsp;&nbsp;<span class="src-key">private&nbsp;</span><span class="src-key">function&nbsp;</span><span class="src-id">candidateList</span><span class="src-sym">(</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1319"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$findAnyElement">findAnyElement</a><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1320"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-id">getAllCandidates</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1321"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1322"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#var$matches">matches</a><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1323"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1324"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a1325"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a1326"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;Get&nbsp;a&nbsp;list&nbsp;of&nbsp;all&nbsp;of&nbsp;the&nbsp;candidate&nbsp;elements.</span></div></li>
<li><div class="src-line"><a name="a1327"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a1328"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;This&nbsp;is&nbsp;used&nbsp;when&nbsp;$this-&gt;findAnyElement&nbsp;is&nbsp;TRUE.</span></div></li>
<li><div class="src-line"><a name="a1329"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc-type">$elements&nbsp;</span></div></li>
<li><div class="src-line"><a name="a1330"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;</span><span class="src-doc">A&nbsp;list&nbsp;of&nbsp;current&nbsp;elements&nbsp;(usually&nbsp;$this-&gt;matches).</span></div></li>
<li><div class="src-line"><a name="a1331"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a1332"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@return&nbsp;</span></div></li>
<li><div class="src-line"><a name="a1333"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;A&nbsp;list&nbsp;of&nbsp;all&nbsp;candidate&nbsp;elements.</span></div></li>
<li><div class="src-line"><a name="a1334"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a1335"></a>&nbsp;&nbsp;<span class="src-key">private&nbsp;</span><span class="src-key">function&nbsp;</span><span class="src-id">getAllCandidates</span><span class="src-sym">(</span><span class="src-var">$elements</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1336"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1337"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$elements&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$item</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1338"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$item</span><span class="src-sym">;&nbsp;</span><span class="src-comm">//&nbsp;put&nbsp;self&nbsp;in</span></div></li>
<li><div class="src-line"><a name="a1339"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$nl&nbsp;</span>=&nbsp;<span class="src-var">$item</span><span class="src-sym">-&gt;</span><span class="src-id">getElementsByTagName</span><span class="src-sym">(</span><span class="src-str">'*'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1340"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$nl&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$node</span><span class="src-sym">)&nbsp;</span><span class="src-var">$found</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$node</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1341"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1342"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-id"><a href="../QueryPath/CSSParser/UniqueElementList.html">UniqueElementList</a></span><span class="src-sym">::</span><a href="../QueryPath/CSSParser/UniqueElementList.html#methodget">get</a><span class="src-sym">(</span><span class="src-var">$found</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1343"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1344"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a1345"></a>&nbsp;&nbsp;<span class="src-key">public&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html#methodnodeListToArray">nodeListToArray</a><span class="src-sym">(</span><span class="src-var">$nodeList</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1346"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$array&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1347"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$nodeList&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$node</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1348"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$node</span><span class="src-sym">-&gt;</span><span class="src-id">nodeType&nbsp;</span>==&nbsp;<span class="src-id">XML_ELEMENT_NODE</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1349"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$array</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$node</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1350"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1351"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1352"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$array</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1353"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1354"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a1355"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1356"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a1357"></a><span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a1358"></a><span class="src-doc">&nbsp;*&nbsp;Specialized&nbsp;handler&nbsp;for&nbsp;only&nbsp;parsing&nbsp;the&nbsp;contents&nbsp;of&nbsp;a&nbsp;negation</span></div></li>
<li><div class="src-line"><a name="a1359"></a><span class="src-doc">&nbsp;*&nbsp;selector.</span></div></li>
<li><div class="src-line"><a name="a1360"></a><span class="src-doc">&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a1361"></a><span class="src-doc">&nbsp;*&nbsp;According&nbsp;to&nbsp;the&nbsp;CSS&nbsp;3&nbsp;selector&nbsp;specification,&nbsp;the&nbsp;negation&nbsp;pseudo-class</span></div></li>
<li><div class="src-line"><a name="a1362"></a><span class="src-doc">&nbsp;*&nbsp;(:not())&nbsp;can&nbsp;only&nbsp;contain&nbsp;a&nbsp;simple&nbsp;selector&nbsp;with&nbsp;no&nbsp;negation&nbsp;handler&nbsp;and</span></div></li>
<li><div class="src-line"><a name="a1363"></a><span class="src-doc">&nbsp;*&nbsp;no&nbsp;pseudo-elements.&nbsp;To&nbsp;meet&nbsp;this&nbsp;requirement,&nbsp;this&nbsp;class&nbsp;implements&nbsp;a</span></div></li>
<li><div class="src-line"><a name="a1364"></a><span class="src-doc">&nbsp;*&nbsp;restricted&nbsp;version&nbsp;of&nbsp;the&nbsp;CssEventHandler&nbsp;that&nbsp;will&nbsp;only&nbsp;parse&nbsp;simple</span></div></li>
<li><div class="src-line"><a name="a1365"></a><span class="src-doc">&nbsp;*&nbsp;selectors.</span></div></li>
<li><div class="src-line"><a name="a1366"></a><span class="src-doc">&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a1367"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@deprecated</span><span class="src-doc">&nbsp;This&nbsp;has&nbsp;been&nbsp;replaced&nbsp;by&nbsp;a&nbsp;full&nbsp;CssEventHandler&nbsp;implementation.</span></div></li>
<li><div class="src-line"><a name="a1368"></a><span class="src-doc">&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a1369"></a><span class="src-key">class&nbsp;</span><a href="../QueryPath/CSSParser/NegationCssEventHandler.html">NegationCssEventHandler</a>&nbsp;<span class="src-key">extends&nbsp;</span><a href="../QueryPath/CSSParser/QueryPathCssEventHandler.html">QueryPathCssEventHandler</a>&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1370"></a>&nbsp;&nbsp;<span class="src-key">public&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../QueryPath/CSSParser/NegationCssEventHandler.html#methodfind">find</a><span class="src-sym">(</span><span class="src-var">$filter</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1371"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$parser&nbsp;</span>=&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id"><a href="../QueryPath/CSSParser/CssParser.html">CssParser</a></span><span class="src-sym">(</span><span class="src-var">$filter</span><span class="src-sym">,&nbsp;</span><span class="src-var">$this</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1372"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$parser</span><span class="src-sym">-&gt;</span><span class="src-id">parseSimpleSelector</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1373"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$this</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1374"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1375"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1376"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a1377"></a><span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a1378"></a><span class="src-doc">&nbsp;*&nbsp;Utility&nbsp;class&nbsp;to&nbsp;winnow&nbsp;a&nbsp;list&nbsp;of&nbsp;Elements&nbsp;down&nbsp;to&nbsp;unique&nbsp;ones.</span></div></li>
<li><div class="src-line"><a name="a1379"></a><span class="src-doc">&nbsp;*&nbsp;This&nbsp;uses&nbsp;strong&nbsp;equality.</span></div></li>
<li><div class="src-line"><a name="a1380"></a><span class="src-doc">&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a1381"></a><span class="src-doc">&nbsp;*&nbsp;Why&nbsp;not&nbsp;use&nbsp;array_unique()?&nbsp;Because&nbsp;that&nbsp;requires&nbsp;a&nbsp;cast&nbsp;to&nbsp;a&nbsp;string,</span></div></li>
<li><div class="src-line"><a name="a1382"></a><span class="src-doc">&nbsp;*&nbsp;which&nbsp;doesn't&nbsp;work&nbsp;well&nbsp;for&nbsp;elements&nbsp;(loses&nbsp;idempotence).</span></div></li>
<li><div class="src-line"><a name="a1383"></a><span class="src-doc">&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a1384"></a><span class="src-key">class&nbsp;</span><a href="../QueryPath/CSSParser/UniqueElementList.html">UniqueElementList</a>&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1385"></a>&nbsp;&nbsp;<span class="src-key">var&nbsp;</span><a href="../QueryPath/CSSParser/UniqueElementList.html#var$result">$result</a><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1386"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a1387"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a1388"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;Given&nbsp;an&nbsp;array&nbsp;of&nbsp;elements,&nbsp;return&nbsp;an&nbsp;array&nbsp;of&nbsp;unique&nbsp;elements.</span></div></li>
<li><div class="src-line"><a name="a1389"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;Static&nbsp;utility&nbsp;method.</span></div></li>
<li><div class="src-line"><a name="a1390"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a1391"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc-type">array&nbsp;</span><span class="src-doc-var">$list&nbsp;</span></div></li>
<li><div class="src-line"><a name="a1392"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;An&nbsp;array&nbsp;of&nbsp;objects.</span></div></li>
<li><div class="src-line"><a name="a1393"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@return&nbsp;</span></div></li>
<li><div class="src-line"><a name="a1394"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;An&nbsp;array&nbsp;of&nbsp;objects&nbsp;with&nbsp;all&nbsp;duplicates&nbsp;removed.</span></div></li>
<li><div class="src-line"><a name="a1395"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a1396"></a>&nbsp;&nbsp;<span class="src-key">public&nbsp;</span><span class="src-key">static&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../QueryPath/CSSParser/UniqueElementList.html#methodget">get</a><span class="src-sym">(</span><span class="src-var">$list</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1397"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$uel&nbsp;</span>=&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id"><a href="../QueryPath/CSSParser/UniqueElementList.html">UniqueElementList</a></span><span class="src-sym">(</span><span class="src-var">$list</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1398"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$uel</span><span class="src-sym">-&gt;</span><span class="src-id">toArray</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1399"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1400"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a1401"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a1402"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;Construct&nbsp;a&nbsp;new&nbsp;list&nbsp;and&nbsp;filter&nbsp;it.</span></div></li>
<li><div class="src-line"><a name="a1403"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a1404"></a>&nbsp;&nbsp;<span class="src-key">public&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../QueryPath/CSSParser/UniqueElementList.html#method__construct">__construct</a><span class="src-sym">(</span><span class="src-var">$list</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1405"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/UniqueElementList.html#var$result">result</a>&nbsp;=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1406"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$list&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$item</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1407"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/UniqueElementList.html#methodcompare">compare</a><span class="src-sym">(</span><span class="src-var">$item</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1408"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1409"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1410"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a1411"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a1412"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;Get&nbsp;the&nbsp;list&nbsp;as&nbsp;an&nbsp;array.</span></div></li>
<li><div class="src-line"><a name="a1413"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a1414"></a>&nbsp;&nbsp;<span class="src-key">public&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../QueryPath/CSSParser/UniqueElementList.html#methodtoArray">toArray</a><span class="src-sym">(</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1415"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/UniqueElementList.html#var$result">result</a><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1416"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1417"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a1418"></a>&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a1419"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;Compare&nbsp;the&nbsp;current&nbsp;element&nbsp;to&nbsp;previous&nbsp;elements&nbsp;in&nbsp;the&nbsp;list.</span></div></li>
<li><div class="src-line"><a name="a1420"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;If&nbsp;it&nbsp;is&nbsp;unique,&nbsp;it&nbsp;is&nbsp;kept.&nbsp;If&nbsp;it&nbsp;is&nbsp;not,&nbsp;it&nbsp;is&nbsp;discarded&nbsp;from</span></div></li>
<li><div class="src-line"><a name="a1421"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*&nbsp;the&nbsp;list.</span></div></li>
<li><div class="src-line"><a name="a1422"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a1423"></a>&nbsp;&nbsp;<span class="src-key">protected&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../QueryPath/CSSParser/UniqueElementList.html#methodcompare">compare</a><span class="src-sym">(</span><span class="src-var">$element</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1424"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/in_array">in_array</a><span class="src-sym">(</span><span class="src-var">$element</span><span class="src-sym">,&nbsp;</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/UniqueElementList.html#var$result">result</a><span class="src-sym">,&nbsp;</span><span class="src-id">TRUE</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1425"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/UniqueElementList.html#var$result">result</a><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$element</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1426"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1427"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1428"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1429"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a1430"></a><span class="src-key">class&nbsp;</span><a href="../QueryPath/CSSParser/NamespaceMap.html">NamespaceMap</a>&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1431"></a>&nbsp;&nbsp;<span class="src-key">protected&nbsp;</span><a href="../QueryPath/CSSParser/NamespaceMap.html#var$map">$map</a>&nbsp;=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1432"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a1433"></a>&nbsp;&nbsp;<span class="src-key">public&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../QueryPath/CSSParser/NamespaceMap.html#method__construct">__construct</a><span class="src-sym">(</span><span class="src-var">$dom</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1434"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$all&nbsp;</span>=&nbsp;<span class="src-var">$dom</span><span class="src-sym">-&gt;</span><span class="src-id">getElementsByName</span><span class="src-sym">(</span><span class="src-str">'*'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1435"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$all&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$e</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1436"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$attrs&nbsp;</span>=&nbsp;<span class="src-var">$e</span><span class="src-sym">-&gt;</span><span class="src-id">getAttributeNS</span><span class="src-sym">(</span><span class="src-str">'xmlns'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1437"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1438"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1439"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a1440"></a>&nbsp;&nbsp;<span class="src-key">public&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../QueryPath/CSSParser/NamespaceMap.html#methodgetNSURI">getNSURI</a><span class="src-sym">(</span><span class="src-var">$name</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1441"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><a href="http://www.php.net/array_key_exists">array_key_exists</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/NamespaceMap.html#var$map">map</a><span class="src-sym">,&nbsp;</span><span class="src-var">$name</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a1442"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../QueryPath/CSSParser/NamespaceMap.html#var$map">map</a><span class="src-sym">[</span><span class="src-var">$name</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a1443"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1444"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1445"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a1446"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a1447"></a><span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a1448"></a><span class="src-doc">&nbsp;*&nbsp;Exception&nbsp;thrown&nbsp;for&nbsp;unimplemented&nbsp;CSS.</span></div></li>
<li><div class="src-line"><a name="a1449"></a><span class="src-doc">&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a1450"></a><span class="src-doc">&nbsp;*&nbsp;This&nbsp;is&nbsp;thrown&nbsp;in&nbsp;cases&nbsp;where&nbsp;some&nbsp;feature&nbsp;is&nbsp;expected,&nbsp;but&nbsp;the&nbsp;current</span></div></li>
<li><div class="src-line"><a name="a1451"></a><span class="src-doc">&nbsp;*&nbsp;implementation&nbsp;does&nbsp;not&nbsp;support&nbsp;that&nbsp;feature.</span></div></li>
<li><div class="src-line"><a name="a1452"></a><span class="src-doc">&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a1453"></a><span class="src-key">class&nbsp;</span><a href="../QueryPath/CSSParser/NotImplementedException.html">NotImplementedException</a>&nbsp;<span class="src-key">extends&nbsp;</span><span class="src-id">Exception&nbsp;</span><span class="src-sym">{</span><span class="src-sym">}</span></div></li>
</ol>
</span></div>
        <div class="credit">
		    <hr class="separator" />
		    Documentation generated on Thu, 19 Mar 2009 18:00:57 -0500 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.2</a>
	      </div>
      </td></tr></table>
    </td>
  </tr>
</table>

</body>
</html>